Not using readlines (save memory)
Published: Wednesday, Dec 26, 2007 Last modified: Wednesday, Mar 29, 2023
Regarding file.readlines(). It doesn’t create a huge list in memory does it?
13:06 < sjj> yeah, it does. 13:06 < sjj> just use, 'for line in file: ...'
use fileinput with bufsize=32768 http://www.python.org/doc/current/lib/module-fileinput.html and linecache http://www.python.org/doc/current/lib/module-linecache.html