1 def v_code(): 2 code_str = ‘‘ 3 for i in range(5): 4 import random 5 num = random.randint(0,9) 6 str1 = chr(random.randint(65,90)) 7 str2 = chr(random.randint(97,122)) 8 code_str +=str(random.choice([num,str1,str2])) 9 return code_str 10 print(v_code()) 11 输出: 12 0WT2Y
原文地址:https://www.cnblogs.com/ch2020/p/12395226.html
时间: 2024-11-02 12:48:04