Most efficient way to write data out to a text file?
peter at engcorp.com
Thu Jun 27 05:56:09 CEST 2002
candiazoo at attbi.com wrote:
> I assume some sort of block i/o or preallocating a large block of file space
> would be the best way to do it? I am outputting about 700,000 records to a text
> file and my program only spits out about 20 records per second. This is using
> standard file open and write...
You're not opening and closing the file for each record that is written, are you?
Can you post more detail on the amount of data in a record, and the format?
Why not profile the code using the profile.py module and actually see
where the problem is?
More information about the Python-list