本人用python3.6寫的,2.幾的版本可能會運行出錯
輸入密碼隱藏顯示及判斷
import getpass #調用getpass
username =input('uarname:')
password =getpass.getpass('password:')
print(username,password) #getpass在pycharm中不好用,在命令提示符運行此代碼,例如: python 文件所在路徑
_username='hehe'
_password ='abc123'
username =input('uarname:')
password =input('password:')
if _username ==username and _password ==password :
print('Welcome user {name} login...' .format(name=username))
else:
print('Invalid uername or password!')