how long a Str can be used in this python code segment?
gherron at islandtraining.com
Mon Feb 1 10:29:20 CET 2010
> tmp=file.read() (very huge file)
> if targetStr in tmp:
> print "find it"
> print "not find"
> I checked if file.read() is huge to some extend, it doesn't work, but
> could any give me some certain information on this prolbem?
Python has no specific limit on string size other than memory size and
perhaps 32 bit address space and so on. However, if your file size is
even a fraction of that size, you should not attempt to read it all into
memory at once. Is there not a way to process your file in batches of a
More information about the Python-list