林心如掳获霍家心,车厘子是什么,大团圆
如下所示:
# coding: utf-8 import paramiko import mysqldb def main(): connection=mysqldb.connect(host='10.10.41.22',user='root',passwd='root',db='trojan',port=3306) cur=connection.cursor() sql ='select count(*) from blacklist;' cur.execute(sql) count = cur.fetchone()[0] print '一共有%s个应用需要上传'%(count) sql = 'select path from blacklist;' cur.execute(sql) host = '10.10.41.22' port = 22 username = 'remote2' password = 'userforremote' t = paramiko.transport((host,port)) t.connect(username=username,password=password) sftp = paramiko.sftpclient.from_transport(t) i=0 for path in cur.fetchall(): bendipath = "/home/wcloud/apk_baseinfo_mounted_point/apk%s"%path apkname =bendipath.split("/")[-1] servicepath = '/home/remote2/blacklist_wandoujia/%s'%apkname print bendipath print servicepath sftp.put(bendipath,servicepath) i=i+1 print '已经上传%s个应用,还有%d个应用没有上传'%(i,(count-i)) if __name__ == '__main__': main()
以上这篇python 实现两个服务器之间文件的上传方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论