[Tutor] Reading large bz2 Files

Norman Rieß norman at smash-net.org
Fri Feb 19 13:42:07 CET 2010


i am trying to read a large bz2 file with this code:

source_file = bz2.BZ2File(file, "r")
for line in source_file:
     print line.strip()

But after 4311 lines, it stoppes without a errormessage. The bz2 file is 
much bigger though.
How can i read the whole file line by line?

Thank you.


More information about the Tutor mailing list