Sure. It might be easier to explain in smaller chunks. Excuse me if I tell you stuff you already know...
Code:
[x for x in range(10)]
This builds a list by walking through the list provided by range(10), effectively making a list like this: [0,1,2,3,4,5,6,7,8,9]
Not very useful by itself
But then we can add a condition, like this:
Code:
[x for x in range(10) if x < 5]
This walks through the list and only includes the value if it meets the condition, so we get [0,1,2,3,4].
Finally, we can modify the value before it is added to the list, like this:
Code:
[x * 2 for x in range(10) if x < 5]
So it takes each value that meets the condition, and multiplies it by 2, so we get [0,2,4,6,8].
So, on to my code:
Code:
files = [ x.strip().split(':',1)[1][3:] for x in y if x.strip()[-4:] == '.txt' ]
x.strip() - removes the spaces
.split(':',1) - breaks the string into two pieces, around the colon (the 1 means to only split once, not for every colon, just in case)
Because the result of split is a list, and we want the data after the colon, I add [1] to get the right list element, then we use [3:] to chop the first 3 characters off the start of the string.
The condition at the end just stops the program from operating on any line that doesn't end with ".txt".
Hope that helps, let me know if you have any questions.