[EMAIL PROTECTED] wrote:
On Jun 2, 2:08 am, "kalakouentin" <[EMAIL PROTECTED]> wrote:
Do you know a way to actually load my data in a more
"batch-like" way so I will avoid the constant line by line reading?
If your files will fit in memory, you can just do
text = file.readlines()
and Python will read the entire file into a list of strings named
'text,' where each item in the list corresponds to one 'line' of the
file.
No that won't help. That has to do *all* the same work (reading blocks
and finding line endings) as the iterator PLUS allocate and build a list.
Better to just use the iterator.
for line in file:
...
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list