Populating a list

mlorfeld matt at lorfeld.com
Sun Dec 9 17:04:05 EST 2001


I am new to python (about 72 hours into learning), and am having
problems with reading a file (sate abbreviations) with one item per
line and populating each line into a list.  The problem is that each
item ends with \012 after each state ie WI\012.

Here is the code that I am using:

f=open('/home/mlorfeld/states.txt', 'r+')
states=f.readlines()#populates a list from file
f.close
print states



More information about the Python-list mailing list