Random passwords generation (Python vs Perl) =)
NoName
zaz600 at gmail.com
Sun Jan 28 23:58:39 EST 2007
Perl:
@char=("A".."Z","a".."z",0..9);
do{print join("", at char[map{rand @char}(1..8)])}while(<>);
!!generate passwords untill U press ctrl-z
Python (from CookBook):
from random import choice
import string
print ''.join([choice(string.letters+string.digits) for i in
range(1,8)])
!!generate password once :(
who can write this smaller or without 'import'?
More information about the Python-list
mailing list