I would like to generate a random number string of N length with this code:
import random
import string
N=512
print ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(N))
What is missing is that I would like to add “special characters like e.g. “@,;:.§$%&/(!””
And I would like to output that to .txt file with a newline after for a example 10,15 signs.
Any help would be great.
Thanks for the time.
Note: string.ascii_letters is the same as string.ascii_uppercase + string.ascii_lowercase.