Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created June 8, 2013 08:06
Show Gist options
  • Select an option

  • Save kissgyorgy/5734481 to your computer and use it in GitHub Desktop.

Select an option

Save kissgyorgy/5734481 to your computer and use it in GitHub Desktop.
Python: Generate random string
# http://stackoverflow.com/questions/2257441/python-random-string-generation-with-upper-case-letters-and-digits/2257449#2257449
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment