Thanks, Steve. For the first step, I just wasn't sure how to write the file.
I appreciate the help. Becky On Sun, Apr 17, 2011 at 12:34 AM, Steven D'Aprano <[email protected]>wrote: > Becky Mcquilling wrote: > >> I'm trying to work out a method to create a binary file of 1mb and I'm >> somewhat confused by the docs I'm reading is there a method that will do >> this? >> > > > # Open a file in binary (b) mode for writing. > fp = open("mybinaryfile", "wb") > # Write whatever data you like to it. > fp.write('\0'*1000000) > fp.close() > > > That writes one million ASCII NULL bytes to the file. If you prefer binary > megabytes instead of decimal megabytes, use 1024*1024 instead of one > million. > > If you want some other binary data, you'll have to tell us what binary data > you want to write. > > > > -- > Steven > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
