In Python, you can read a file and load its lines into a list by using
f = open(\'file.txt\',\'r\')
lines = f.readlines()
Each individual l
If it's a concern, open in binary format and convert with this code:
from __future__ import with_statement
with open(filename, "rb") as f:
s = f.read().replace('\r\n', '\n').replace('\r', '\n')
lines = s.split('\n')
f = open('file.txt','rU')
This opens the file with Python's universal newline support and \r
is treated as an end-of-line.