I\'m new to python and just trying to learn how to make my code more pythonic. I\'m reading a file into a list of strings and then reading these strings into their own list in p
The for clauses go in the same order as if you had written a nested loop.
for
data = [list(item) for line in open(filename, 'r') for item in line.strip()]
You should be using a with statement, though:
with
with open(filename, 'r') as f: data = [list(item) for line in f for item in line.strip()]