本文介绍了getPass()在Eclipse中回显密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,所有这一切刚刚开始在一个Python中玩耍,以帮助在工作中的几个脚本,但是我似乎在一个小问题上挂起了。

Hey all just started dabbling in a little Python to help out with a few scripts at work, but I seem to be getting hung up on a little issue.

我使用Eclipse与pydev作为我的开发平台,并针对python 2.7.3开发。我只是试图提醒用户他们的密码,使用:

I am using Eclipse with pydev for my development platform and developing against python 2.7.3. I am just trying to prompt a user for their password, using:

password = getpass.getpass()

该行在终端/命令提示符下运行时正常工作,但是当我在Eclipse控制台中运行时,用户的输入不是像它应该是隐藏的。任何想法如何解决这个问题?

That line works as expected when running in the terminal/command prompt, however when I am running in the Eclipse console, the user's input isn't hidden like it should be. Any ideas how to fix this?

推荐答案

这是一个记录的行为 - 一些终端不能进行无回波输入,情况下,应该发出警告:

This is documented behaviour - some terminals are not capable of echo-free input, in that case, it should give a warning instead:

这篇关于getPass()在Eclipse中回显密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 03:45