当前位置:网站首页>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)
边栏推荐
- POAP:NFT的采用入口?
- What you learned in the eleventh week
- Hand drawn video website
- ROS command line tool
- 【FPGA教程案例9】基于vivado核的时钟管理器设计与实现
- Hedhat firewall
- 微信小程序:全新独立后台月老办事处一元交友盲盒
- Global and Chinese markets of emergency rescue vessels (errv) 2022-2028: Research Report on technology, participants, trends, market size and share
- Actual combat simulation │ JWT login authentication
- Expose testing outsourcing companies. You may have heard such a voice about outsourcing
猜你喜欢
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
Postman automatically fills headers
Huawei employs millions of data governance experts! The 100 billion market behind it deserves attention
User login function: simple but difficult
微信小程序:最新wordpress黑金壁纸微信小程序 二开修复版源码下载支持流量主收益
Basic operations of database and table ----- delete index
[wave modeling 3] three dimensional random real wave modeling and wave generator modeling matlab simulation
I was beaten by the interviewer because I didn't understand the sorting
SAP UI5 应用开发教程之一百零六 - 如何提高 SAP UI5 应用路由 url 的可读性试读版
Chia Tai International Futures: what is the master account and how to open it?
随机推荐
如果消费互联网比喻成「湖泊」的话,产业互联网则是广阔的「海洋」
[microprocessor] VHDL development of microprocessor based on FPGA
SAP UI5 应用开发教程之一百零七 - SAP UI5 OverflowToolbar 容器控件介绍的试读版
【大型电商项目开发】性能压测-优化-中间件对性能的影响-40
Senior Test / development programmers write no bugs? Qualifications (shackles) don't be afraid of mistakes
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
La jeunesse sans rancune de Xi Murong
多模输入事件分发机制详解
Check if this is null - checking if this is null
微信小程序:微群人脉微信小程序源码下载全新社群系统优化版支持代理会员系统功能超高收益
小程序直播 + 电商,想做新零售电商就用它吧!
Mongodb series learning notes tutorial summary
当产业互联网时代真正发展完善之后,将会在每一个场景见证巨头的诞生
Daily question brushing record (13)
抓包整理外篇——————状态栏[ 四]
Discrete mathematics: Main Normal Form (main disjunctive normal form, main conjunctive normal form)
Robley's global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
微信小程序;胡言乱语生成器
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
Global and Chinese markets for industrial X-ray testing equipment 2022-2028: Research Report on technology, participants, trends, market size and share