网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
12月19日漏签0天
python吧 关注:480,205贴子:1,982,611
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 7回复贴,共1页
<<返回python吧
>0< 加载中...

各位帮个忙,出现了图片上的问题怎么解决啊,拜托了,卡了好久了

  • 只看楼主
  • 收藏

  • 回复
  • Zenjoy
  • 举人
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
from openpyxl.workbook import Workbook
from openpyxl.reader.excel import load_workbook
from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font
import re
# from openpyxl.writer.excel import ExcelWriter
# import xlrd
ft = Font(name='Neo Sans Intel', size=11) # define font style
bd = Border(left=Side(border_style='thin', color='00000000'), \
right=Side(border_style='thin', color='00000000'), \
top=Side(border_style='thin', color='00000000'), \
bottom=Side(border_style='thin', color='00000000')) # define border style
alg_cc = Alignment(horizontal='center', \
vertical='center', \
text_rotation=0, \
wrap_text=True, \
shrink_to_fit=True, \
indent=0) # define alignment styles
alg_cb = Alignment(horizontal='center', \
vertical='bottom', \
text_rotation=0, \
wrap_text=True, \
shrink_to_fit=True, \
indent=0)
alg_lc = Alignment(horizontal='left', \
vertical='center', \
text_rotation=0, \
wrap_text=True, \
shrink_to_fit=True, \
indent=0)
patch_file_name = "C:\\Users\\matebook14\\Desktop\\ABC.txt"
patch_file = open(patch_file_name, 'r',encoding='UTF-8') # get data patch text
wb = load_workbook('C:\\Users\\matebook14\\Desktop\\Android_Patch_Review-Y2015.xlsx') # open excel to write
sheetnames1 = wb.sheetnames()
ws = wb.get_sheet_by_name('data') # get sheet
rows = len(ws.rows)
assert ws.cell(row=rows,
column=1).value != None, 'New Document or empty row at the end of the document? Please input at least one row!'
print
"The original Excel document has %d rows totally." % (rows)
end_tag = 'type: stats'
for line in open(patch_file_name):
line = patch_file.readline()
if re.match(end_tag, line) is not None: # end string
break
if len(line) == 1: # go to next patch
rows = rows + 1
continue
line = line.strip()
# print line
ws.cell(row=rows + 1, column=1).value = ws.cell(row=rows, column=1).value + 1 # Write No.
ws.cell(row=rows + 1, column=1).font = ft
ws.cell(row=rows + 1, column=1).border = bd
ws.cell(row=rows + 1, column=1).alignment = alg_cb
ws.cell(row=rows + 1, column=5).border = bd
ws.cell(row=rows + 1, column=9).border = bd
if re.match('change', line) is not None:
ws.cell(row=rows + 1, column=2).value = re.sub('change', '', line) # Write Gerrit ID
ws.cell(row=rows + 1, column=2).font = ft
ws.cell(row=rows + 1, column=2).border = bd
ws.cell(row=rows + 1, column=2).alignment = alg_cb
if re.match('url:', line) is not None:
ws.cell(row=rows + 1, column=3).value = re.sub('url:', '', line) # Write Gerrit url
ws.cell(row=rows + 1, column=3).font = ft
ws.cell(row=rows + 1, column=3).border = bd
ws.cell(row=rows + 1, column=3).alignment = alg_cb
if re.match('project:', line) is not None:
ws.cell(row=rows + 1, column=6).value = re.sub('project:', '', line) # Write project
ws.cell(row=rows + 1, column=6).font = ft
ws.cell(row=rows + 1, column=6).border = bd
ws.cell(row=rows + 1, column=6).alignment = alg_lc
if re.match('branch:', line) is not None:
ws.cell(row=rows + 1, column=7).value = re.sub('branch:', '', line) # Write branch
ws.cell(row=rows + 1, column=7).font = ft
ws.cell(row=rows + 1, column=7).border = bd
ws.cell(row=rows + 1, column=7).alignment = alg_cc
if re.match('lastUpdated:', line) is not None:
ws.cell(row=rows + 1, column=8).value = re.sub('lastUpdated:|CST', '', line) # Write update time
ws.cell(row=rows + 1, column=8).font = ft
ws.cell(row=rows + 1, column=8).border = bd
ws.cell(row=rows + 1, column=8).alignment = alg_cc
if re.match('commitMessage:', line) is not None:
description_str = re.sub('commitMessage:', '', line)
if re.match('Product:|BugID:|Description:|Unit Test:|Change-Id:', line) is not None:
description_str = description_str + '\n' + line #
if re.match('Signed-off-by:', line) is not None:
description_str = description_str + '\n' + line
ws.cell(row=rows + 1, column=4).value = description_str # Write patch description
ws.cell(row=rows + 1, column=4).font = ft
ws.cell(row=rows + 1, column=4).border = bd
ws.cell(row=rows + 1, column=4).alignment = alg_lc
wb.save('Android_Patch_Review-Y2015.xlsx')
print ('Android_Patch_Review-Y2015.xlsx saved!\nPatch Collection Done!')
# patch_file.close()


  • Zenjoy
  • 举人
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
救救孩子吧


2025-12-19 04:32:09
广告
不感兴趣
开通SVIP免广告
  • 一周休七日
  • 吧主
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


  • ×今我来思×
  • 探花
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
不都告诉你这玩意是个列表里不用加()


  • 咕咕咕
  • 探花
    11
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼


  • 没来的宝贝阿土
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Python是一种跨平台的计算机程序设计语言。 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越多被用于独立的、大型项目的开发。


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 7回复贴,共1页
<<返回python吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示