Skip to content

Instantly share code, notes, and snippets.

@vividvilla
Created March 14, 2017 08:48
Show Gist options
  • Save vividvilla/745f278ce6768be0abb96a955f5e9d0e to your computer and use it in GitHub Desktop.
Save vividvilla/745f278ce6768be0abb96a955f5e9d0e to your computer and use it in GitHub Desktop.
Random string generator in Python
import string
import random
def random_string(size):
"""Generate a random string from a given length"""
return "".join(random.SystemRandom()
.choice(string.ascii_lowercase + string.digits) for _ in range(size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment