Skip to content

Instantly share code, notes, and snippets.

@sennajox
Created November 18, 2012 04:11
Show Gist options
  • Save sennajox/4103476 to your computer and use it in GitHub Desktop.
Save sennajox/4103476 to your computer and use it in GitHub Desktop.
Create a simple list containing random strings
#!/usr/bin/env python
import sys, os
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase):
return ''.join(random.choice(chars) for x in range(size))
if __name__ == "__main__":
argc = len(sys.argv)
if argc < 3:
print "usage: %s file count" % sys.argv[0]
exit(1)
file = open(sys.argv[1], 'w')
count = int(sys.argv[2])
for i in range(0, count):
str = id_generator(25)
str += "\n"
#print str
file.write(str)
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment