标签:pycha 代码 col class 结果 div ali else 输入密码
1.getpass
1 import getpass 2 username = input("username:") 3 password = getpass.getpass("password:") 4 print(username,password)
在pycharm中运行下面的代码时不能输入密码(软件问题,代码没错),选择命令行执行
密码默认不显示
例子:
1 import getpass 2 _usename = "fww" 3 _password = "123" 4 username = input("username:") 5 password = getpass.getpass("password:") 6 print(username,password) 7 if _usename == username and _password == password: 8 print("Welcome user {name} login".format(name = username)) 9 else: 10 ; print("Invalid username or password")
结果显示
标签:pycha 代码 col class 结果 div ali else 输入密码
原文地址:https://www.cnblogs.com/xifeng59/p/11628218.html