学习python
:
这就是我正在做的事情:
PyDev
控制台:开始。
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/username/SpiderOak Hive/VirtualEnvs-Python/server_inventory2wiki'])
Python 3.5.3 (default, May 10 2017, 15:05:55)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux
import paramiko
user = "ec2-user"
host = "ec2-35-165-xxx-xx.us-west-2.compute.amazonaws.com"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
key_file = "/home/skeer/Downloads/pythontarget.pem"
ssh.connect(hostname = host, username = user, key_filename = key_file)
stdin, stdout, stderr = ssh.exec_command ('uname -a')
print stdout.read()
File "<input>", line 1
print stdout.read()
^
stdin, stdout, stderr = ssh.exec_command ('ifconfig')
print stdout.read()
File "<input>", line 1
print stdout.read()
^
SyntaxError: invalid syntax
但exec_command
实际上什么也没做。