how to read file lines into list python code example Example: read a file line by line into a list with open(fname) as f: content = f.read().splitlines()