标签:style sp on bs ef amp as tt new
# coding: gbk
import random
import string
import re
def numx():
while 1:
#t=re.compile(r‘[a-z0-9A-Z]‘)
n=‘‘.join(random.sample(string.letters+string.digits,4)).strip(‘/n‘).replace(‘,‘,‘,‘)
print n
xp=re.compile(‘\w+‘, re.I)
rxp=xp.findall(n)[0].upper()
#t1=t.match(n)
#print n.strip(‘-‘)
#n.split("[‘,‘]")
num1=raw_input(‘请输入和上面对应验证:‘)
print ‘num1=%s, rxp=%s‘ % ( num1.upper(), rxp )
#if num1.upper() in rxp or num1.lower()in rxp:
if num1.upper() == rxp:
print ‘验证码正确‘
print‘不区分大小写‘
break
else:
print‘验证码不正确‘
print‘不区分大小写‘
continue
numx()
标签:style sp on bs ef amp as tt new
原文地址:http://www.cnblogs.com/mhxy13867806343/p/4156422.html