1.python实现验证码
import random
code_list=[]
for i in range(6):
state=random.randint(1,3)
if state ==1:
first_kind=random.randint(65,90)
random_uppercase=chr(first_kind)
code_list.append(random_uppercase)
elif state ==2:
second_kind=random.randint(97,122)
random_lowercase=chr(second_kind)
code_list.append(random_lowercase)
elif state==3:
third_kind=random.randint(0,9)
code_list.append(str(third_kind))
verification_code="".join(code_list)
print(verification_code)
import random
yanzhengma=[]
for i in range(6):
j= random.randint(1,3)
if j ==1:
a=random.randint(65,90)
b=chr(a)
yanzhengma.append(b)
if j ==2:
a=random.randint(97,122)
b=chr(a)
yanzhengma.append(b)
if j ==3:
a=random.randint(0,9)
yanzhengma.append(str(a))
yanzhengmashuchu="".join(yanzhengma)
print(yanzhengmashuchu)
任课老师 汪峰