generating random passwords.

makepass.py

from random import choice
import string
def GenPasswd(length=8, chars=string.letters+string.digits):
    return ''.join([ choice(chars) for i in range(length) ])
ahiliation:~$python
Python 2.5.5 (r255:77872, Mar 20 2010, 05:19:32)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import makepass
>>> for i in range(6):
...    print makepass.GenPasswd(12)
...
BSxqLK9mpq4R
FRlppP7K2Che
YBkz0QZMJojC
JjTQlcHzDsC3
WMD5BfRcyTEk
quO9nlBirm2U
>>>

Credit : Devin Leung.