param_service/random_code.py
cuijingwei@brisonus.com 1ea9a7031d 通信服务设计
2025-02-19 14:35:44 +08:00

14 lines
366 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)