performance – Python fastest way to read a large text file (several GB)

performance – Python fastest way to read a large text file (several GB)

with open(<FILE>) as FileObj:
    for lines in FileObj:
        print lines # or do some other thing with the line...

will read one line at the time to memory, and close the file when done…

performance – Python fastest way to read a large text file (several GB)

Leave a Reply

Your email address will not be published. Required fields are marked *