list comprehension help

Shane Geiger sgeiger at ncee.net
Mon Mar 19 01:50:54 EDT 2007


Since you are dealing with that much information perhaps pytables would 
be useful to you.    http://pytables.sourceforge.net



rkmr.em at gmail.com wrote:
> Hi
> I need to process a really huge text file (4GB) and this is what i
> need to do. It takes for ever to complete this. I read some where that
> "list comprehension" can fast up things. Can you point out how to do
> it in this case?
> thanks a lot!
>
>
> f = open('file.txt','r')
> for line in f:
>         db[line.split(' ')[0]] = line.split(' ')[-1]
>         db.sync()
>   

-- 
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sgeiger.vcf
Type: text/x-vcard
Size: 310 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070319/d1fca119/attachment.vcf>


More information about the Python-list mailing list