Le Mon, 20 Apr 2009 07:59:15 +0100, "Alan Gauld" <alan.ga...@btinternet.com> s'exprima ainsi:
> > #Open and read text file > > > > gradesfile = open("grades.dat", "r" > > for lines in gradesfile: > > lines = lines.split(",") > > identifier = lines[0] > > lastname = lines[1] > > firstname = lines[2] > > major = lines[3] > > OK so far Not OK for me. The structure is the one of a table. A variety of words/concepts/metaphors can properly describe a table structure. But the above choice is certainly wrong: It says that a table row/record is a 'lines' *and* is made of 'lines'! Possible alternatives: for record in gradesfile: fields = record.split(",") for row in gradesfile: cells = row.split(",") for line in gradesfile: data = line.split(",") # 'data' is supposed to be plural of 'datum' (?) Denis ------ la vita e estrany _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor