Skip to content

Instantly share code, notes, and snippets.

@stevekrenzel
Created February 12, 2012 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekrenzel/1810703 to your computer and use it in GitHub Desktop.
Save stevekrenzel/1810703 to your computer and use it in GitHub Desktop.
Password Generator
from sys import argv, exit
from random import choice
from string import ascii_letters, digits
if len(argv) < 2:
print "usage: %s length [quantity]" % (argv[0])
exit(1)
length, quantity = int(argv[1]), 1
if len(argv) == 3:
quantity = int(argv[2])
def password(length):
return ''.join(choice(ascii_letters + digits) for c in range(length))
print '\n'.join(password(length) for i in range(quantity))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment