当我在 Eclipse 中运行以下代码时,getPass 返回一个以回车符结尾的字符串。
但是,当我在命令提示符下运行相同的代码时,它运行没有任何问题。
import paramiko
import getpass
userPwd = getpass.getpass()
print ('You have entered ',userPwd)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('ese.rnd.sanl.se', username='abc',
password=userPwd)
stdin,stdout,stderr=ssh.exec_command("ls")
data1=stdout.read().splitlines();
for line in data1:
print (line)
输出(日食):
Warning: Password input may be echoed.
Password: Mypassword@123
('You have entered ', 'Mypassword@123\r')
输出(命令提示符):
Warning: Password input may be echoed.
Password: Mypassword@123
('You have entered ', 'Mypassword@123')
任何人都可以解释这种歧义吗?
谢谢!!