rajeevs1992

randPass.py

Sep 25th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import random
  2. def gen():
  3. small='a b c d e f g h i j k l m n o p q r s t u v w x y z'
  4. caps=small.upper().split()
  5. small=small.split()
  6. num='1 2 3 4 5 6 7 8 9 0'.split()
  7. lst=''
  8. passwd=''
  9. for i in range(0,8):
  10. ch=random.randint(1,3)
  11. if ch==1:
  12. lst=small
  13. elif ch==2:
  14. lst=caps
  15. else:
  16. lst=num
  17. passwd+=lst[random.randint(0,len(lst)-1)]
  18. return passwd
  19. if __name__ == "__main__":
  20. print gen()
Advertisement
Add Comment
Please, Sign In to add comment