how to generate a random string in python with mixed numbers code example
Example 1: generate random string python
import string
import random
length=5
#python2
randomstr = ''.join(random.sample(string.ascii_letters+string.digits,length))
#python3
randomstr = ''.join(random.choices(string.ascii_letters+string.digits,k=length))
Example 2: generate random string python
''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))