write() vs. writelines()

Fredrik Lundh fredrik at pythonware.com
Fri May 26 14:36:14 EDT 2006


Gregory Petrosyan wrote:

> My question is: why write(''.join(...)) works slowly than
> writelines(...)? Here's the code:

the first copies all the substring to a single string large enough to 
hold all the data, before handing it over to the file object, while the 
second just writes the substrings to the file object.

</F>




More information about the Python-list mailing list