random string and digit generation in python
Nov
17
1
0
This snippet generates a random string with digits with a defined LENGTH in Python. Useful for things like generating random passwords.
import os import string LENGTH = 6 password = ''.join(random.choice(string.ascii_letters + string.digits) for x in range(LENGTH))