Creating file of size x

Grant Edwards grante at visi.com
Mon Jun 6 19:18:46 EDT 2005


On 2005-06-06, Jan Danielsson <jan.danielsson at gmail.com> wrote:

>    Is there any way to create a file with a specified size?

Sure:  

 1) Open a new file for writing.
 2) Seek to "specified size"-1.
 3) Write one byte. 

-- 
Grant Edwards                   grante             Yow!  I just put lots of
                                  at               the EGG SALAD in the SILK
                               visi.com            SOCKS --



More information about the Python-list mailing list