码迷,mamicode.com
首页 > 编程语言 > 详细

python getpass模块:隐藏不显示输入的密码

时间:2016-08-08 22:41:19      阅读:527      评论:0      收藏:0      [点我收藏+]

标签:

不知道为什么,本机测试必须要在debug模式下才正常运行。。

import getpass                                  #用于隐藏用户输入的字符串,常用来接收密码

def checkuser(user,passwd):
    if user == ‘chenhang‘ and passwd == ‘123456‘:
        return True
    else:
        return False

if __name__ == "__main__":
    userr = input(‘Input the user:‘)
    passwdd = getpass.getpass(‘Input the passwd:‘)

    if checkuser(userr,passwdd):
        print(‘OK!‘)
    else:
        print(‘ERROR!‘)

 

python getpass模块:隐藏不显示输入的密码

标签:

原文地址:http://www.cnblogs.com/hanggegege/p/5751155.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!