simple text filter
Batista, Facundo
FBatista at uniFON.com.ar
Wed Jun 11 16:49:27 EDT 2003
#- I need some help on a simple text filter. The problem I am having is
#- when the file comes to the end it stays in the while loop
#- and does not
#- exit. I cannot figure this out. I would use a for loop with the
#- readlines() but my datasets can range from 5 to 80 MB of text data.
#- Here is the code I am using. Please help.
If you're using Python 2.3, you can do this:
f = file('yourfile.txt', 'r')
for junky in f:
...
If you want to terminate the for anytime, use 'break'.
. Facundo
More information about the Python-list
mailing list