Python: Generador de passwords aleatorios

Generador de passwords aleatorios en Python
!/usr/bin/env python
"""
Usage: ./password.py [length]
 
Generates a random password 8 chars long (by default) with letters, digits and punctuation
"""

#Import Modules
import sys
import string
from random import Random
 
rng = Random()
chars = string.letters + string.digits + string.punctuation
 
try:
    length = int(sys.argv[1])
except:
    length = 8

print ''.join([rng.choice(chars) for i in range(length)])

Updated: