你知道如何在Linux中尝试一些Sudo的东西它会告诉你输入密码,当你输入时,终端窗口中没有显示任何内容(密码没有显示)?
有没有办法在Python中做到这一点?我正在编写一个需要如此敏感信息的脚本,并希望在我输入时隐藏它.
换句话说,我想从用户那里获取密码而不显示密码.
有没有一种方法可以在用户输入星号时转换字符,就像在许多网站上看到的那样?
例如,如果要求电子邮件用户登录其帐户,则在输入密码时,它不会显示为字符,而是显示*在每个单独的笔划之后,没有任何时间延迟.
如果是实际密码KermitTheFrog,则会*************在输入时显示.
def lock():
global pas,lk
lk=Tk.Frame(main)
lk.pack(fill="both", anchor="center", expand=1)
Tk.Label(lk, text="", font="arial 75").pack(anchor="center", side="top")
fpas=Tk.LabelFrame(lk, text="Zadejte heslo:")
fpas.pack(anchor="center")
pas=Tk.Entry(fpas)
pas.pack()
Tk.Button(lk, text="OK", command=check).pack(side="top")
Tk.Button(lk, text="Vypnout", command=lkend).pack(side="top")
return
Run Code Online (Sandbox Code Playgroud)
This is a part of my code and I want to change it. When I write my password into Tk.Entry called pas, I don´t want to see numbers, but a only specific symbol, such as * or another symbol. Thanks for the answer.
P.S: Please don´t evaluate my code, I know that I …