Forked from ilivessevili/quickly create large file in python
Last active
April 13, 2018 14:13
-
-
Save flarco/e27402262320d0a3bf66712d5ca66dd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
data = { | |
'1MB' : 1*1024*1024, # 1MB | |
'10MB' : 10*1024*1024, # 10MB | |
'100MB' : 100*1024*1024, # 100MB | |
'1GB' : 1*1024*1024*1024, # 1GB | |
'10GB' : 10*1024*1024*1024, # 10GB | |
'50GB' : 50*1024*1024*1024, # 50GB | |
} | |
for key in data: | |
print('Writing ' +key) | |
with open(key+'.test', 'wb') as fout: | |
fout.write(os.urandom(data[key])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment