如何将服务器 IP 作为变量包含在 python 中的 wget 命令?

How to include wget command in python with server IP as a variable?

我尝试使用以下代码从具有不同 IP 地址的服务器下载文件,但它不起作用。如何将 URL 中的服务器 IP 地址作为变量包含在内? 注意:我在 post 中包含了 iperf 命令作为示例,因为它工作正常。

我包含了服务器和客户端的 wget 命令 python 文件。

server.cmd("iperf -s > /dev/null &" )
server.cmd("python -m SimpleHTTPServer 8000  &")
client.cmd("iperf -c %s -t %d > /dev/null &" % (server.IP(), 1990))
client.cmd("wget  http://&server.IP()&:8000/DCN.py &")

我希望客户端可以从指定的 IP 服务器下载 DCN.py。

为什么不像 iperf 命令那样使用格式字符串?

client.cmd("wget http://%s:8000/DCN.py &" % server.IP())