Python: string with random characters and specified length

Short snippet

import string
import random

length = 100
characters = string.letters + string.digits
''.join(random.choice(characters) for _ in range(length))
comments powered by Disqus