getpass模块
来源:互联网 发布:推广必备软件 编辑:程序博客网 时间:2024/04/27 13:14
http://docs.python.org/2/library/getpass.html
The getpass module provides two functions:
- getpass.getpass([prompt[, stream]])
Prompt the user for a password without echoing.The user is prompted using the string prompt, which defaults to 'Password: '.
Many programs that interact with the user via the terminal need to ask the user for password values without showing what the user types on the screen.The getpass module provides a portable way to handle such password prompts securely.
Example
The getpass() function prints a prompt then reads input from the user until they press return. The input is passed back as a string to the caller.
import getpassp = getpass.getpass()print 'You entered:', p
The default prompt, if none is specified by the caller, is “Password:”.
$ python getpass_defaults.pyPassword:You entered: sekret
The prompt can be changed to any value your program needs.
import getpassp = getpass.getpass(prompt='What is your favorite color? ')if p.lower() == 'blue': print 'Right. Off you go.'else: print 'Auuuuugh!'
I don’t recommend such an insecure authentication scheme, but it illustrates the point.
$ python getpass_prompt.pyWhat is your favorite color?Right. Off you go.$ python getpass_prompt.pyWhat is your favorite color?Auuuuugh!
- getpass模块
- python的getpass模块
- python getpass模块
- getpass模块和random模块
- python getpass模块不起效果
- Python中的getpass模块介绍
- Python资料之getpass模块
- [Python模块学习]使用getpass模块无回显输入
- python3 基础模块(随机数,bisect,匹配统计,压缩,csv,logging,getpass,configparser等模块)
- getpass.c
- getpass()函数
- getpass使用
- getpass ()函数
- getpass函数
- 胜过getPass()的软件
- itoa/atoi/getpass
- getpass函数用法
- 注意getpass()函数
- apktool+dex2jar+xjad反编译APK文件
- EKF/UKF/IMM
- 黑马训练营——多线程之创建线程
- SQL触发器基础
- C#递归求解Factorial数列
- getpass模块
- 使用opengl绘制一个立方体
- EcShop充值卡功能插件(1)
- Debug--寄存器的十六进制
- cocos2d-x VS2008 安装出现的问题
- 黑马程序员——线程同步的几种方式
- java实现二分查找
- VS2012下基于Glut OpenGL GL_QUADS示例程序:
- 用C++程序删除文本文件中以“//”开头的行