Skip to content

Instantly share code, notes, and snippets.

@diegueus9
Created March 9, 2016 19:01
Show Gist options
  • Select an option

  • Save diegueus9/cfcd557e1f9674013e81 to your computer and use it in GitHub Desktop.

Select an option

Save diegueus9/cfcd557e1f9674013e81 to your computer and use it in GitHub Desktop.
A password generator in python
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