The following example loads the file into memory only one line at a
time, so it should suit your purposes:

>>> data = file( "important.dat" , "w" )
>>> data.write("this\nis\nimportant\ndata")
>>> data.close()

now read it....

>>> import re
>>> data = file( "important.dat" , "r" )
>>> line = data.readline()
>>> while line:
        for x in re.finditer( "\w+" , line):
                print x.group()
        line = data.readline()

        
this
is
important
data
>>> 


-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to