Random passwords generation (Python vs Perl) =)
Paul Rubin
http
Mon Jan 29 00:52:37 EST 2007
"NoName" <zaz600 at gmail.com> writes:
> 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'?
If you don't mind possibly getting a few nonalphanumeric characters:
import os,binascii
print binascii.b2a_base64(os.urandom(6))
More information about the Python-list
mailing list