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