首页 > 编程语言 > 详细

python 通过urllib模块在svn中下载文件

时间:2016-04-12 10:02:20      阅读:267      评论:0      收藏:0      [点我收藏+]

#_*_coding:utf-8_*_

import urllib

def Schedule(a,b,c):
‘‘‘
a:已经下载的数据块
b:数据块的大小
c:远程文件的大小
‘‘‘
per = 100.0 * a * b / c
if per > 100:
per = 100
print "%.2f%%"% per

 

f=file(‘a.txt‘)#文件路径保存
for i in f.readlines():
c=i.strip().split(‘/‘)
b=‘/Python27/a/%s‘%‘‘.join(c[-1:])
i=i.decode("gb2312").encode(‘utf-8‘)#读取文本中内容后转码
urllib.urlretrieve(i,b,Schedule)

 

python 通过urllib模块在svn中下载文件

原文:http://www.cnblogs.com/liguangxu/p/5381480.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!