我需要使用python读取远程文件内容,但在这里我面临一些挑战。我的代码如下:
import subprocess
path = 'http://securityxploded.com/remote-file-inclusion.php'
subprocess.Popen(["rsync", host-ip+path],stdout=subprocess.PIPE)
for line in ssh.stdout:
line
这里我得到了错误NameError: name 'host' is not defined
。我不知道host-ip
值应该是什么,因为我使用终端(python sub.py
)运行Python文件。这里我需要读取http://securityxploded.com/remote-file-inclusion.php
远程文件的内容。在
你需要urllib库。你也在使用你不使用的参数。 试试这样的方法:
注意:这是针对python3的
对于python 2.7,请使用以下命令:
^{pr2}$如果您想通过http读取远程内容。在
请求或urllib2都是不错的选择。在
对于Python2,使用请求。在
会有用的。在
相关问题 更多 >
编程相关推荐