"Faster" I/O in a script

miller.paul.w at gmail.com miller.paul.w at gmail.com
Mon Jun 2 20:42:08 EDT 2008


On Jun 2, 2:08 am, "kalakouentin" <kalakouen... at yahoo.com> 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.



More information about the Python-list mailing list