with open(filename) as f: content = f.readlines() # you may also want to remove whitespace characters like ` ` at the end of each line content = [x.strip() for x in content]