# -*- coding:utf-8 -*-
# Auther:Leon
import getpass
user=input("请输入账号:")
pwd=getpass.getpass("请输入密码:")
if user == "leon" and pwd == "leon" :
print("logs-in successfully")
else:
print("Username or Password NG")ps:
Python实现星号遮掩的密码输入参考:http://blog.csdn.net/sbdxxcjh/article/details/39120095
py3中输入密码时隐藏
原文:http://blog.51cto.com/leonsecurity/2052748