zoukankan      html  css  js  c++  java
  • getpass不起作用

    #! /usr/bin/env python
    # -*- coding:utf-8 -*-

    # login 模块中登录时输入密码,想用getPass模块实现密码的不回显操作。
    #如下:
    import getpass
    ret = input("welcome to the system:please make a choice-1 or 2")
    if ret == '1':
        user = input("请输入用户名:")
        pwd = getpass.getpass("请输入密码:")
    

      


    #结果:
    #在pycharm中根本不起作用,用官方带的IDLE显示如下:
    """
    welcome to the system:please make a choice-1 or 21
    请输入用户名:wuwuwu

    Warning (from warnings module):
    File "C:Program FilesPython36libgetpass.py", line 100
    return fallback_getpass(prompt, stream)
    GetPassWarning: Can not control echo on the terminal.
    Warning: Password input may be echoed.
    请输入密码:123456
    用户名不存在
    >>>
    """

    # 命令行界面中测试可行,getpass模块只能用于命令行界面!
    # stack overflow 上 有大神如是说:
    """
    Use an actual terminal -- that is, an environment where stdin,
    stdout and stderr are connected to /dev/tty, or another PTY-compliant device.

    The IDLE REPL does not meet this requirement.
    """


  • 相关阅读:
    关于typecho发布文章后的错位
    Python3 和 Python2的区别
    django apache error.log过大
    php 数组转json格式
    php get传递数据
    SVN中文件属性
    linux中django+apache配置
    php添加环境变量
    php和apache安装心得
    php 5.6.14手动安装 php -v 显示没有安装
  • 原文地址:https://www.cnblogs.com/wuxinyan/p/9032686.html
Copyright © 2011-2022 走看看