Created
September 8, 2010 12:23
-
-
Save lidaobing/570047 to your computer and use it in GitHub Desktop.
genPassword
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
#!/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