临时练习

 用def 函数写登陆

import json
def land(u,p):
    passwor = input('whe\'t your password')
    if passwor ==p:
        wriths='file.json'
        with open(wriths,'w') as odj:
            json.dump(u,odj)
            json.dump(p,odj)
            print("完成注册")
    else:
        print("密码和上次不一致")
        passwor = input('whe\'t your password')
        if passwor == p:
            wriths = 'file.json'
            with open(wriths, 'w') as odj:
                json.dump(u,odj)
                json.dump(p,odj)
                print("完成注册")
        else:
            print("机会已经用完50分钟后再试")





username =input("whe\'t your username?")
password =input('whe\'t your password')
land(username,password)

猜你喜欢

转载自www.cnblogs.com/515hmg/p/9648252.html