Created
April 9, 2012 21:04
-
-
Save btc/2346524 to your computer and use it in GitHub Desktop.
Creates file of test fragments for cs107/assn1
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 string | |
import random | |
def mkfrag(N): | |
body = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(N)) | |
return "#" + body + "#" | |
if __name__ == '__main__': | |
nfrags = input('how many frags? ') | |
fraglength = input('frag length: ') | |
filename = raw_input('enter filename to write: ') | |
file = open(filename,"w") | |
for i in range(nfrags): | |
file.write(mkfrag(fraglength)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment