Skip to content

Instantly share code, notes, and snippets.

@whtsky
Created July 19, 2014 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save whtsky/c7d5f7a7b86b89fbb37e to your computer and use it in GitHub Desktop.
Save whtsky/c7d5f7a7b86b89fbb37e to your computer and use it in GitHub Desktop.
Generate random string in Python
import random
s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789^!\\$%&/()=?{[]}+~#-_.:,;<>|\\'
def create():
return ''.join([random.choice(s) for _ in range(16)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment