Created
March 9, 2016 19:01
-
-
Save diegueus9/cfcd557e1f9674013e81 to your computer and use it in GitHub Desktop.
A password generator in python
This file contains hidden or 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 sys | |
| from random import choice | |
| def __main__(*args, **kwargs): | |
| try: | |
| size = args[0][1] | |
| choiceable = string.letters*2 + string.digits*3 + string.punctuation | |
| print(''.join(choice(choiceable) for i in range(int(size)))) | |
| except IndexError: | |
| print("You should give me at least the number of characteres in the password") | |
| except ValueError: | |
| print("You should give me a number smart-ass") | |
| if __name__ == '__main__': | |
| __main__(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment