Short snippet
import string import random length = 100 characters = string.letters + string.digits ''.join(random.choice(characters) for _ in range(length))