If I was creating a sparse file from scratch and I wanted to make it the size of n I would use bytestream.seek(n-1) to offset the pointer and then write a single null byte at the end. Much quicker than writing a bytestream of n length!
However, if I've opened said file with open(…,'ab'), seek() is no longer an option, as soon as I call write() the position resets to the end of the file, as stated in the documentation. It seems the only option when using python's ammend is to write each individual null byte.
Is there another way of appending null bytes to a pre-existing file efficiently and quickly?