码迷,mamicode.com
首页 > 编程语言 > 详细

python学习ing

时间:2019-08-01 14:31:29      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:rand   验证   pass   注册验证   特殊   print   ber   inpu   int   

##注册验证用户
def users():
users_ = input(‘users: ‘)
k1 = ‘qwertyuiopasdfghjklzxcvbnm‘
k2 = ‘1234567890‘
k3 = ‘!@#$%^&*()_+‘
is_k1 = False
is_k2 = False
is_k3 = True #初始化变量
for i in users_:
if i in k1:
is_k1 = True
if i in k2:
is_k2 = True
if i in k3:
is_k3 = False
if is_k1 and is_k2 and is_k3:
password()
else:
print(‘不能有特殊字符‘)
 


def password():
password = input(‘输入密码: ‘)
if len(password)<6:
print(‘密码必须大于六位‘)
else:
phone()

def phone():
phone = input(‘请输入电话: ‘)
if len(phone) != 11:
print(‘电话号码无效‘)
else:
print(‘验证码已发送‘)
verfily_number()

def verfily_number():
import random
import time
num=random.randrange(1000,9999)
Start_time = time.time()
print(‘验证码是: %d ‘%num)
num_ = int(input(‘请输入验证码‘))
end_time = time.time()

sub_time = end_time - Start_time
if sub_time > 10:
print(‘验证码失效,重发...‘)
time.sleep(2)
verfily_number()
else:
if num == num_:
print(‘验证成功‘)
else:
print(‘验证错误‘)
 
def Start():
users()

Start()


python学习ing

标签:rand   验证   pass   注册验证   特殊   print   ber   inpu   int   

原文地址:https://www.cnblogs.com/ty-wk/p/11282072.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!