import random

def len_t(len = 4):
    c = ""
    for i in range(len):
        c = c + str(random.randint(0,9))

    return c

l = input("请指定验证码长度,不指定则输入回车：")
try:
    l = int(l)
    res = len_t(l)
    print(f"验证码为：{res}")
except ValueError:
    res = len_t()
    print(f"验证码为：{res}")

