不知道為什么,本機測試必須要在debug模式下才正常運行。。
import getpass #用於隱藏用戶輸入的字符串,常用來接收密碼 def checkuser(user,passwd): if user == 'chenhang' and passwd == '123456': return True else: return False if __name__ == "__main__": userr = input('Input the user:') passwdd = getpass.getpass('Input the passwd:') if checkuser(userr,passwdd): print('OK!') else: print('ERROR!')