Created
January 15, 2018 02:00
-
-
Save ipan/fb35a6380e9be12459c77cd2aed3e880 to your computer and use it in GitHub Desktop.
generate random string
This file contains 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
def rand_string(length): | |
""" Generates a random string of numbers, lower- and uppercase chars. """ | |
rand_str = ''.join(random.choice(string.ascii_lowercase | |
+ string.ascii_uppercase | |
+ string.digits) | |
for i in range(length)) | |
return rand_str | |
print(rand_string(10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment