Best way to write a file n-bytes long

Sybren Stuvel sybrenUSE at YOURthirdtower.imagination.com
Tue Aug 26 18:24:38 EDT 2003


Tony C enlightened us with:
> Sure, I could create a string that is n Megabytes long, and pass it to
> write, but it seems as though there should be a better way ???
> String manipulation is typically considered slow.

Why not create a string that is 1 KB long and write that n*1024 times?

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 




More information about the Python-list mailing list