0 Replies - 1993 Views - Last Post: 11 January 2012 - 09:42 PM

#1 Vblaster   User is offline

  • New D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 16-January 11

Password generator.

Posted 11 January 2012 - 09:42 PM

Description: gen(3)Generates a random password of user specified length.
import string
import random
def gen(length):
	random.seed()
	letters = list(string.letters)
	numbers = [1,2,3,4,5,6,7,8,9,0]
	a = 0
	newpass =[]
	while a < length:
		ranchars =[]
		randle = random.choice(letters)
		rannum = random.choice(numbers)
		ranchars.append(randle)
		ranchars.append(str(rannum))
		ranchar = random.choice(ranchars)
		newpass.append(ranchar)
		a+=1
	return string.join(newpass)




Is This A Good Question/Topic? 0
  • +

Page 1 of 1