举一反三,取buglist中的url

最近客户提出的的BUG比较多,但是一一筛选出url又比较麻烦,所以从客户的BUGLIST的description中去取url,写了个简单的获取url输出到excel的方法:-D

以下是源码:

# -*- coding: utf-8 -*-
import re,xlwt,xlrd
from xlutils.copy import copy
def reinfourl(test):
    m = re.search(r"[a-zA-z]+://[^\s]*",test)
    if m :
        return m.group(0)
    else:
        return "no url"
    
oldex = xlrd.open_workbook(r"buglist218.xls")
oldsh = oldex.sheet_by_index(0)
nrows = oldsh.nrows
newex  = copy(oldex)
newsh = newex.get_sheet(0)
for i in range(1,nrows):
    test = oldsh.cell(i,3).value
    newsh.write(i,4,reinfourl(test))
    print "#%d"%i,reinfourl(test)
newex.save(r"buglist218.xls")
    

取回来excel style:

posted @ 2016-02-18 10:36  虫子宴  阅读(504)  评论(0编辑  收藏  举报