码迷,mamicode.com
首页 > 其他好文 > 详细

getpass模块

时间:2015-11-03 11:52:02      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:

# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#getpass模块



import getpass
‘‘‘
>>> help(getpass)

FUNCTIONS
    getpass = win_getpass(prompt=‘Password: ‘, stream=None)
        Prompt for password with echo off, using Windows getch().
    
    getuser()
        Get the username from the environment or password database.
        
        First try various environment variables, then the password
        database.  This works on Windows as long as USERNAME is set.

DATA
    __all__ = [‘getpass‘, ‘getuser‘, ‘GetPassWarning‘]
‘‘‘

#获得登陆的用户名
print  getpass.getuser()#Administrator


#getpass.getpass([prompt[, stream]]);prompt:为用户输入的提示字符串,默认为:Password:
print  getpass.getpass()#请输入密码

 

getpass模块

标签:

原文地址:http://www.cnblogs.com/dengyg200891/p/4932499.html

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