我编写了一个简单的程序来使用getpass
从命令中捕获密码,但该程序正在挂起
我想抓住密码并显示它。
import getpass
class PasswordEnter:
def enterPassword(self):
while True:
print("--------------")
password = getpass.getpass(prompt='Enter Password: ', stream=None)
if not password:
continue
else:
print("Actual Password : ", password)
break
if __name__ == '__main__':
test = PasswordEnter();
test.enterPassword()
Pycharm不直接允许捕获密码。我们必须告诉Pycharm表现得像一个终端。以下是以下步骤。