Code to build a list z to contain all the first words in each line of a
text file:

z=[]

f=open('C:/atextfile.txt')

for aLine in f:

str=aLine

a=str.split()

z.append(a)


I would like to work further with the list z once the file has been
stripped, and the list is complete but am so clueless about Python and its
curlybracelessness that I don't know when the for loop terminates.
Obviously I don't want to write to the file after every line is read.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to