但我不想在剧本里硬编码密码。我使用的是getpass,但是当我运行脚本时,它会在enable命令中失败。我得到了“坏秘密”。我知道这是因为密码错误。我知道shell必须在命令的末尾添加\n。/bin/python3import timessh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
pa
有没有办法在python shell中隐藏密码,就像显示圆点一样。这是为了在python程序中进行登录输入。getpass显示了以下内容: File "C:\Python34\lib\getpass.py", line 101 GetPassWarning: Can not control echo on
获取信息:[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.
>>> from getpass import getpass>>> g