在外壳程序中将用户输入回显为“ *”或类似内容

时间:2018-10-05 15:51:31

标签: python passwords echo user-input

例如,我正在尝试注册并登录systen,我希望用户在输入密码而不是“ Password123”时看到“ ***********”。 / p>

with open("UandP.txt", "a") as x:
    x.write(input("Enter a username: "))
    x.write(",")
    x.write(input("Enter a password: ") + "\n")

我希望'input("Enter a password: ")'的输入在外壳程序中以'*'的形式回显,但是我不能使用getpass(),因为它在外壳程序中不起作用

0 个答案:

没有答案