Created
September 23, 2017 10:39
-
-
Save arwankhoiruddin/fdc4c1c3e14e1399cc73fb779cfea282 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 random | |
import sys | |
#this is to create file with certain amount of size | |
sizeWanted = int(sys.argv[1]) # in kilobytes | |
sizeWanted = sizeWanted*1024 # convert from byte into kilobyte | |
wordCreated = '' | |
fileName = sys.argv[2] | |
tmp = -1 | |
for i in range(sizeWanted): | |
pct = (100 * i) / sizeWanted | |
if tmp != pct: | |
print "percentage of the file created: " + str(pct) | |
tmp = pct | |
wordCreated = wordCreated + chr(98) | |
f = open(fileName, 'w') | |
f.write(wordCreated) | |
f.close() | |
#print wordCreated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment