# -*- 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()#请输入密码
时间: 2024-10-22 12:12:23