Jump to content
Romania-

Password generator[Python]

Recommended Posts

Posted
from random import randint

pamount = int(raw_input("How many passwords do you want to generate?\n"))
plength = int(raw_input("How many characters should be in your password(s)?\n"))
filename = raw_input("What do you want the name of your file to be?\n")
son = int(raw_input("Do you want symbols or not? 2 = yes, 1 = no\n"))
text = open(filename + ".txt", 'a')

loopcount = 0

while loopcount < pamount:
password = ""
loopcount2 = 0
while loopcount2 < plength:
if son == 1:
if randint(1, 2) == 1:
password += chr(randint(65, 90))
else:
password += chr(randint(97, 122))
loopcount2 += 1
else:
password += chr(randint(33, 125))
loopcount2 += 1
text.write(password + '\n')
loopcount += 1

text.close()

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...