user60704
0
Q:

python password generator

import string
from random import *
characters = string.ascii_letters + string.punctuation  + string.digits
password =  "".join(choice(characters) for x in range(randint(8, 16)))
print password
4
import random

alph = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ\
             abcdefghijklmnopqrstuvwxyz\
             1234567890 !@#$%^&*(){}[]<>,.')
out = ''
for char in string:
    out += random.choice(alph)
    
print(out)
1
import random
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@£$%^&*().,?0123456789'

number = input('Please enter a number of passwords.')
try:
    number = int(number)
except:
    print("Error, please enter a number!")

length = input('Length of password?')
try:
    length = int(length)
except:
    print("Error, please enter a number!")

print('\nHere are your password(s):')

for pwd in range(number):
  password = ''
  for c in range(length):
    password += random.choice(chars)
  print(password)
1
#This is giving you a password with 8 strings and 4 numbers:
import random
i=0 
list=[]
while i < 12:
    while i < 8:
        list.append(random.choice(string.ascii_letters))
        i+=1
    while i < 12:
        list.append(random.randint(0, 9))
        i+=1
    
list=' '.join([str(elem) for elem in list])
print("Your new password: ", list.replace(" ", ""))
0

New to Communities?

Join the community