在Pycharm编辑器中调用getpass模块

本文探讨了在PyCharm中使用Python的getpass模块遇到的问题及解决方法。作者发现PyCharm不支持getpass模块,而在命令行和其他环境中可以正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 兴趣来潮想复习一下python中的getpass模块编辑器使用Pycharm很简单的代码写完执行不到输入部分代码如下

1
2
3
4
5
6
7
import  getpass
print ( """
  --------------------**************-----------------
""" )
#ss=getpass.getpass('please The password:')
=  getpass.getpass( 'input your password:' )
print (s)

执行结果

1
2
C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe C: / Users / Administrator / PycharmProjects / s14 / helloword.py
  - - - - - - - - - - - - - - - - - - - - * * * * * * * * * * * * * * - - - - - - - - - - - - - - - - -

  但是事与愿违并没有出现理想的状况 input your password:   ,由于初学python所以始终自己哪里敲错了检查了几遍没有错误同时执行的时候没有任何的报错就想着是不是编辑器的原因

于是在Windows的命令行执行以上代码出现了预期的结果

1
2
3
4
5
6
7
8
9
10
11
C:\Users\Administrator>python
Python  3.5 . 2  (v3. 5.2 : 4def2a2901a5 , Jun  25  2016 22 : 18 : 55 ) [MSC v. 1900  64  bit (AMD64)] on win32
Type  "help" "copyright" "credits"  or  "license"  for  more information.
>>>  import  getpass
>>> p = getpass.getpass( 'input your password:' )
input  your password:
>>>  print (p)
88
>>> p = getpass.getpass( 'input your password:' )
input  your password:
>>>  print (p)

  在其他工具下执行也出现了预期的结果于是就比较纳闷了开始百度和各种找资料最后发现Pycharm竟然不支持getpass模块。

wKiom1jL4YOz7K8xAAAby65Oyx0348.png-wh_50



本文转自 tianya1993 51CTO博客,原文链接:http://blog.51cto.com/dreamlinux/1907763,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值