Random password generator Python script

A Simple and effective two line python code for password generator.

A short, readable password generator that can be launched from the command line. Just launch it from the shell and it will print out an 8-character password. You can also specify the length.

string_list = [ch for ch in string.digits if not ch in '10'] + 
               [ch for ch in string.ascii_uppercase if not ch in 'LO']  + 
                [ch for ch in string.ascii_lowercase if not ch in 'lo'] 

return string.join(random.sample(string_list,8),'')
Share

Leave a Reply

Your email address will not be published. Required fields are marked *