When reading the text file, I'm using:
import io
with io.open('MasterList.txt', encoding='latin-1') as myfile:
data=myfile.read().replace('\n', '')
But printing something like data[0]
gives me the first character instead of the first line. How can I make data
be a list where each element is a line from the text file? Each line ends in \n
. Do I have to somehow use that as the marker of where a new line begins?
No comments:
Post a Comment