question re file as sequence
Sun Jul 11 01:50:26 CEST 2004
I have a file with contents like:
I want to print out the names of all the fruits. Is the following valid?
f = open(filename)
for line in f:
if line == 'Fruit:\n':
The issue here is that the sequence has been mutated inside the loop.
If the above isn't good, anyone have a favorite alternative to doing
it like that?
More information about the Python-list