更新 ranstr 函数

This commit is contained in:
c3b2a 2021-02-07 12:06:31 +08:00 committed by GitHub
parent 156d20864c
commit 9827f4a5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import random import random
import string import string
def main(context): async def main(context):
try: try:
length = int(context.text.split()[1]) length = int(context.text.split()[1])
except: except:
@ -11,4 +11,4 @@ def main(context):
s = "" s = ""
for i in range(length): for i in range(length):
s += random.choice(string.ascii_letters + string.digits) s += random.choice(string.ascii_letters + string.digits)
return f"`{s}`" return f"`{s}`"