日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

1.编写登录接口

發(fā)布時(shí)間:2024/7/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 1.编写登录接口 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
需求:
.編寫(xiě)登錄接口
·輸入用戶(hù)名密碼
·認(rèn)證成功后顯示歡迎信息
·輸錯(cuò)三次后鎖定 # Author rendelei


while True:
list1 = []
list2 = []
count = int(3)
f = open("login.txt",‘w+’)
for line in f:
hostname = str(line.split('\t')[0])
list1.append(hostname)
password = str(line.split("\t")[1]).strip()
list2.append(password)
username = input("username:")

if username in list1:
while True:
passwd = input("passwd:")
if passwd not in list2:
count = count - 1
print("wrong password,you have {_count} chance to login".format(_count=count))

if count == 0:
print("you have no chance ,the {_username} is been locked,fuck off".format(_username=username))
lockfile = open("lock.txt", 'a+')
lockfile.write("\n"+ username)
lockfile.close()
break
else:
if passwd in list2 and list1.index(username) == list2.index(passwd):
print("welcome {_user_username} login the system".format(_user_username=username))
break
break

else:

message = input("wrong username,do you want to register it?")

if message == "y":
username = input("username:")
passwd = input("passwd:")
f1 = open("login.txt","a+")
f1.write("\n"+username+ "\t")
f1.write(passwd)
f1.flush()
f1.close()
print ("the {_username} is register successful,pls login!".format(_username=username))
continue



else:
print("you have exit the system!")
break
f.close()

'''
1.?continue 語(yǔ)句跳出本次循環(huán),而break跳出整個(gè)循環(huán)。
2.注冊(cè)用戶(hù)完成后,直接顯示login,之前用continue的問(wèn)題是,文件用戶(hù)名沒(méi)有刷新,和讀該文件。
'''

2.修改添加注冊(cè)功能流程圖:

?

轉(zhuǎn)載于:https://www.cnblogs.com/druex/p/6550384.html

總結(jié)

以上是生活随笔為你收集整理的1.编写登录接口的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。