有没有办法在这里使用多线程,因此如果创建了4个节点,文件将并行发送到4个节点。
#!/usr/bin/python2
import os
x = raw_input("Enter no. of nodes you want to create: ")
print "\nEnter ip as follows -- 1 192.168.0.1 \n"
d = dict(raw_input().split() for _ in range(int(x)))
for i in d:
os.system("sshpass -p 'abc@abc' scp /root/Desktop/abc.py root@" + d[i]
+":/root/Desktop/md/")
print "configured successfully " + i
提前致谢