How to hide password input during python3 interaction

高洛峰
Release: 2017-03-26 18:40:48
Original
3932 people have browsed it

This article mainly provides an in-depth analysis of the method of hiding the input password during python3 interaction. It has a certain reference value. Interested friends can refer to it

# Auther: Aaron Fan

#这个脚本请在命令行去执行才可以试出效果,pycharm这里无法测试这个脚本,切记!
import getpass

_username = "Aaron"
_passwd = "abc,123"
username = input("请输入你的用户名: ")
#getpass这个模块可以帮助你输入密码时把密码隐藏
passwd = getpass.getpass("请输入你的密码: ")

if username == _username and passwd == _passwd:
   print("你的用户名密码输入正确。")
else:
   print("你的用户名或者密码错误!")
Copy after login

The above is the detailed content of How to hide password input during python3 interaction. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template