Skip to content

Instantly share code, notes, and snippets.

@bofm
Last active April 20, 2017 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bofm/82a87f08d5d5415591fa to your computer and use it in GitHub Desktop.
Save bofm/82a87f08d5d5415591fa to your computer and use it in GitHub Desktop.
python generate random string
# Python 3
import random
import string
''.join(random.choice(string.ascii_letters + string.digits + '#$-=_') for n in range(32))
# Python 2
import random
import string
''.join([random.choice(string.ascii_letters + string.digits + '#$-=_') for n in xrange(32)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment