In order to create a strong, randomized password in Python, you can use the random
and string
modules.
main.py377 chars11 lines
This function will return a random password of the length you specify. It uses random.choices
to select length
number of characters from a string made up of all letters (both lowercase and uppercase), digits, and punctuation marks. If you want, you can update the all_characters
variable to only include certain types of characters (e.g. only letters and digits) to fit your specific use case.
gistlibby LogSnag