Last active
October 30, 2019 11:29
-
-
Save giasuddin90/41cea3229c3b109fba2b2e397f948de9 to your computer and use it in GitHub Desktop.
Generate python short code by using random library, We need short code for sms verification, user verification , mail verification, token service
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
__author__ = 'giasuddin' | |
import string | |
import random | |
def code_generator(size=6, chars=string.ascii_uppercase + string.digits): | |
""" | |
Generate python short code, We need short code for sms verification, user verification , mail verification, token service | |
:param size: | |
:param chars: | |
:return: | |
""" | |
return ''.join(random.choice(chars) for _ in range(size)) | |
if __name__ == '__main__': | |
print(code_generator()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment