2017-08-31 486 views
-1
def logInOkay(): 
    print("You must login before proceeding") 
    userId = input("User ID") 
    userPw = input("Password") 
    if (userId=="Mr Leeman") and (userPw=="Treeroad!"): 
    return True 
    else: 
    print("Error in userId or password") 
    return False 

我需要能够输入(treeroad!),但它需要隐藏并用星号替换。我如何在我的python程序中输入密码以显示为星号

+0

similar:https://stackoverflow.com/questions/35805078/how-do-i-convert-a-password-into-asterisks-while-it-is-being-entered/35805111 – akp

回答

0

您将需要使用getch()而不是input()。

请参阅this帖子上的答案。

相关问题