生成5位随机数
1 import random 2 3 def v_code(): 4 code="" 5 for i in range(5): 6 add_num = random.randrange(10) 7 code +=str(add_num) 8 9 print(code) 10 11 v_code()
1 import random 2 3 def v_code(): 4 code="" 5 for i in range(5): 6 7 add =random.choice([random.randrange(10),chr(random.randrange(65,91))]) 8 9 code +=str(add) 10 11 print(code) 12 13 v_code()