I need to create files of arbitrary size that do not contain data. They are potentially quite large. Although I could just skip the loop and write one null character until I reached a file size that seems ugly.
with open(filename,'wb') as f: # what goes here?
What is an effective, pythonic way to do this?
You can search for a specific position and write bytes, and the OS will magically do the rest of the file.
with open(filename, "wb") as f: f.seek(999999) f.write("\0")
For this you need to write at least one byte.
with open('zero', 'w') as f: f.seek(999999999) f.write('\0')
, . , , , ( , )