Automatically Simple Since 2002
09 December 2010
Commonly I create temporary files using dd like this:
dd if=/dev/random of=blah bs=1m count=16
That will generate a random 16MB file named blah.
Doing the same thing in python looks something like this:
with open("blah", 'w') as f:
for i in range((16*2**20)/512):
f.write(os.urandom(512))
Posting here because it took me about 15 minutes longer than it should have to find that function.