import string
import random
lst = [random.choice(string.ascii_letters + string.digits) for n in range(30)]
str = ''.join(lst)
print(str)
ocwbKCiuAJLRJgM1bWNV1TPSH0F2Lb
Most lightweight way to create a random string and a random hexadecimal number