Project

General

Profile

Files » 2.14test.py

UserName LastName, 02/14/2025 11:06 AM

 
import random

def len_t(len = 4):
c = ""
for i in range(len):
r = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
c = c + r[random.randint(0,36)]

return c

l = input("请指定验证码长度,不指定则输入回车:")
try:
l = int(l)
res = len_t(l)
print(f"验证码为:{res}")
except ValueError:
res = len_t()
print(f"验证码为:{res}")

(174-174/437)