python学习登录器

2021-07-02 17:07

阅读:606

标签:strong   pytho   sys   python   else   dex   次数   index   app   

import os,sys,getpass,time,json

print(‘*欢迎来到召唤师峡谷‘)
login_name = input(‘请输入您的账号:‘)
lock_file = open(‘lock_file.txt‘,‘r+‘)
lock_list = lock_file.readlines()
lock = []
for lock_info in lock_list:
lock_info = lock_info.strip(‘\n‘)
lock.append(lock_info)
#print(lock)
if login_name in lock:
sys.exit("你的账号被封停,请联系客服")

user_file = open(‘user_file.txt‘,‘r+‘)
user_list = user_file.readlines()
#user_list = user_list.strip(‘\n‘)
user = []
for user_info in user_list:
user_info = user_info.strip(‘\n‘)
user_info = user_info.split() #
user.append(user_info)
print(user)
count = 0
b = [x[0] for x in user]
a = [x[1] for x in user]
print(b)
print(a)
if login_name in b:
while count login_pwd = input(‘请输入密码:‘)
if login_pwd == a[b.index(login_name)]:
sys.exit(‘即将进入游戏‘)
else:
count += 1
print(‘密码错误,请重新输入,你好友%s次机会‘%(3-count))
else:
lock_file.write(login_name + ‘\r\n‘)
sys.exit(‘输入次数过多,账号已被绑定‘)
else:
print(‘账号不存在‘)

lock_file.close()
user_file.close()

python学习登录器

标签:strong   pytho   sys   python   else   dex   次数   index   app   

原文地址:http://blog.51cto.com/13965173/2173889


评论


亲,登录后才可以留言!