I need to generate random text strings of a particular format. Would like some ideas so that I can code it up in Python. The format is <8 digit number><15 character st
Shorter version since python 3.6.2, with random.choices
over random.choice which doesn't need a for loop, but instead just pass k, the length of the random string required.
import random
import string
x = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
print(x)
You can also add string.punctuation
if you need string with punctuation characters.