param_service/random_code.py

14 lines
366 B
Python
Raw Normal View History

2025-02-19 14:35:44 +08:00
import random
import string
# # 生成一个随机整数作为识别码例如1000 到 9999
# random_id = random.randint(1000, 9999)
# 或者生成一个随机的 8 位字母和数字组成的字符串
random_str = ''.join(random.choices(string.ascii_letters + string.digits, k=12))
# 插入命令中
command = f"random str: {random_str}"
print(command)