I'm new user of stackoverflow, besides I'm not an English guy, so I'm sorry for my english.
I was programming in python 'til I got a mistake tho I'm not able to figure out what's wrong...
#!/usr/bin/env python2.7
from random import choice
import sys
def help():
print ("Please, you need to introduce a Int in this way: PWrand 10")
def PWrand(insert_by_user):
chars = 'ABCDEFGHIJKLMNOPQRSTUWXYZabcdefghijklmnopqrstuwxyz0123456789!-_:.,;&)('
for password in range(insert_by_user):
sys.stdout.write(choice(chars))
#Command Line
if __name__ == '__main__':
if len(sys.argv) < 2 or len(sys.argv) > 2:
help()
elif (type(sys.argv[2]) != int):
print("It need to be an Int!")
else:
insert_by_user = (sys.argv[2])
print(PWrand(insert_by_user))
So, this is what I take.
Traceback (most recent call last):
File "./passwordrandom.py", line 24, in <module>
elif (type(sys.argv[2]) != int):
IndexError: list index out of range
Thank you all!