SearchEngineRank_Ver0.2.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Daily-code 作者: rui7157 项目源码 文件源码
def generate_xls(urls, keys, result,filename):
    """?????excel??"""
    xls_file = xlwt.Workbook()
    sheet = xls_file.add_sheet(unicode(filename), cell_overwrite_ok=True)
    font0 = xlwt.Font()
    font0.name = 'Times New Roman'
    font0.colour_index = 2
    font0.bold = True
    style0 = xlwt.XFStyle()
    style0.font = font0
    row = 0
    sheet.col(0).width = 256 * 20
    sheet.col(1).width = 256 * 30
    sheet.col(2).width = 256 * 20

    sheet.write(0, 0, u"??", style0)
    sheet.write(0, 1, u"???", style0)
    sheet.write(0, 2, u"??", style0)
    if urls != None and keys != None and result != None:
        for url, key, res in zip(urls, keys, result):
            row += 1
            sheet.write(row, 0, url.decode("utf-8"))
            sheet.write(row, 1, key.decode("utf-8"))
            sheet.write(row, 2, res.decode("utf-8"))
    fpath=os.path.join(os.path.dirname(sys.argv[0]),u"{}.xls".format(unicode(filename))) #??????
    print u"[??]???????{}".format(fpath)
    xls_file.save(fpath)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号