writing large files quickly
rbt at athop1.ath.vt.edu
Fri Jan 27 15:14:48 EST 2006
Grant Edwards wrote:
> On 2006-01-27, Tim Chase <python.list at tim.thechases.com> wrote:
>>>f = file('large_file.bin','wb')
>>While a mindblowingly simple/elegant/fast solution (kudos!), the
>>OP's file ends up with full of the character zero (ASCII 0x30),
>>while your solution ends up full of the NUL character (ASCII 0x00):
> Oops. I missed the fact that he was writing 0x30 and not 0x00.
> Yes, the "hole" in the file will read as 0x00 bytes. If the OP
> actually requires that the file contain something other than
> 0x00 bytes, then my solution won't work.
Won't work!? It's absolutely fabulous! I just need something big, quick
and zeros work great.
How the heck does that make a 400 MB file that fast? It literally takes
a second or two while every other solution takes at least 2 - 5 minutes.
Awesome... thanks for the tip!!!
Thanks to all for the advice... one can really learn things here :)
More information about the Python-list