当前位置:网站首页>Using openpyxl module to write the binary list into excel file
Using openpyxl module to write the binary list into excel file
2022-07-05 01:15:00 【xutengfei999】
import openpyxl import os if sys.platform == "win32": EMAIL_PATH = "F:/email" else: EMAIL_PATH = "/usr/local/workspace-ztcm/email"
# Write the two-dimensional list of stored error information to the specified path def writeToExcel(file_path, new_list): email_dir_path = os.path.join(file_path, timestamp) if not os.path.exists(email_dir_path): os.makedirs(email_dir_path) emailfile_path = os.path.join(email_dir_path,' Zhengtong media data crawling exception notice .xlsx') wb = openpyxl.Workbook() ws = wb.active ws.title = ' Abnormal information of Zhengtong media ' #sheet name for r in range(len(new_list)): for c in range(len(new_list[0])): ws.cell(r + 1, c + 1).value = new_list[r][c] # excel The rows and columns in are from 1 Start counting , So we need to +1 wb.save(emailfile_path) # Save after writing print(" Successfully written file : " + emailfile_path + " !") return 1
if __name__ == "__main__":
error_log_list= [['ccgp_shaanxi_feibiao', ' China government procurement network ', '200: 86 302: 1 403: 1', 'F:/spider_log\\\\ccgp_shaanxi_feibiao\\\\20220208112516\\\\scrapy_ccgp_shaanxi_feibiao_2022_2_8.log', '2022-02-08 11:28:05 '], ['ccgp_shaanxi_zhongbiao', ' China government procurement network ', '200: 4074 302: 11 403: 11', 'F:/spider_log\\\\ccgp_shaanxi_zhongbiao\\\\20220208131055\\\\scrapy_ccgp_shaanxi_zhongbiao_2022_2_8.log', '2022-02-08 15:13:51 ']]
writeToExcel(EAMIL_PATH,error_log_list)
边栏推荐
- Database postragesql client authentication
- Arbitrum: two-dimensional cost
- Robley's global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
- 【大型电商项目开发】性能压测-性能监控-堆内存与垃圾回收-39
- Take you ten days to easily complete the go micro service series (IX. link tracking)
- Query for Boolean field as "not true" (e.g. either false or non-existent)
- Global and Chinese markets of radiation linear accelerators 2022-2028: Research Report on technology, participants, trends, market size and share
- Introduction to the gtid mode of MySQL master-slave replication
- POAP:NFT的采用入口?
- Call Huawei order service to verify the purchase token interface and return connection reset
猜你喜欢
Senior Test / development programmers write no bugs? Qualifications (shackles) don't be afraid of mistakes
微信小程序:全网独家小程序版本独立微信社群人脉
Single step debugging of master data reading of SAP commerce cloud products
华为百万聘请数据治理专家!背后的千亿市场值得关注
Yyds dry goods inventory kubernetes management business configuration methods? (08)
SAP UI5 应用开发教程之一百零六 - 如何提高 SAP UI5 应用路由 url 的可读性试读版
Arbitrum: two-dimensional cost
全栈开发提效神器——ApiFox(Postman + Swagger + Mock + JMeter)
Armv8-a programming guide MMU (3)
程序员SQL数据脚本编码能力弱,BI做不出来怎么办?
随机推荐
Basic operations of database and table ----- create index
Global and Chinese markets of emergency rescue vessels (errv) 2022-2028: Research Report on technology, participants, trends, market size and share
Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
C basic knowledge review (Part 3 of 4)
Postman automatically fills headers
RB technology stack
142. Circular linked list II
Chia Tai International Futures: what is the master account and how to open it?
The most complete regular practical guide of the whole network. You're welcome to take it away
微信小程序:独立后台带分销功能月老办事处交友盲盒
[flutter topic] 64 illustration basic textfield text input box (I) # yyds dry goods inventory #
Take you ten days to easily complete the go micro service series (IX. link tracking)
Game 280 of leetcode week
Single step debugging of master data reading of SAP commerce cloud products
MongoDB系列之学习笔记教程汇总
SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction
Global and Chinese market of optical densitometers 2022-2028: Research Report on technology, participants, trends, market size and share
Basic operation of database and table ----- the concept of index
[Chongqing Guangdong education] National Open University spring 2019 1042 international economic law reference questions
Huawei employs millions of data governance experts! The 100 billion market behind it deserves attention