标签:else and mat put int import ... 模块 pytho
方法一:
1 # Author:yebo 2 _username = "yebo" 3 _password = 123 4 5 username = input("username:") 6 password = int(input("password:")) 7 8 if _username == username and _password == password: 9 print("welcome user {name} loging......".format(name = username)) 10 else: 11 print("invalid username or password!")
方法二(导入getpass模块使得输入密码时隐藏):
# Author:yebo import getpass username = input("username:") password = getpass.getpass("password:") info = ‘‘‘ username:{_username} password:{_password} ‘‘‘.format(_username = username,_password = password) print(info)
标签:else and mat put int import ... 模块 pytho
原文地址:https://www.cnblogs.com/SongjiangCyclone/p/9373995.html