Skip to content

Instantly share code, notes, and snippets.

@lidaobing
Created September 8, 2010 12:23
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 lidaobing/570047 to your computer and use it in GitHub Desktop.
Save lidaobing/570047 to your computer and use it in GitHub Desktop.
genPassword
#!/usr/bin/env python
import string
import random
import sys
def getPassword(length):
a = string.letters + string.digits
res = ''.join([random.choice(a) for i in range(length)])
return res
def main():
length = 12
if len(sys.argv) > 1:
length = int(sys.argv[1])
for i in range(5):
print getPassword(length)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment