Created
March 14, 2017 08:48
-
-
Save vividvilla/745f278ce6768be0abb96a955f5e9d0e to your computer and use it in GitHub Desktop.
Random string generator in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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