当前位置:网站首页>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)
边栏推荐
- 创新引领方向 华为智慧生活全场景新品齐发
- Robley's global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
- User login function: simple but difficult
- SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction
- [Chongqing Guangdong education] National Open University spring 2019 1042 international economic law reference questions
- Intel sapphire rapids SP Zhiqiang es processor cache memory split exposure
- Huawei employs millions of data governance experts! The 100 billion market behind it deserves attention
- POAP:NFT的采用入口?
- Digital DP template
- 无心剑英译席慕容《无怨的青春》
猜你喜欢
Implementation steps of master detail detail layout mode of SAP ui5 application
Arbitrum:二维费用
pycharm专业版下载安装教程
ROS command line tool
POAP:NFT的采用入口?
26.2 billion! These universities in Guangdong Province have received heavy support
JS implementation determines whether the point is within the polygon range
What you learned in the eleventh week
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
Grabbing and sorting out external articles -- status bar [4]
随机推荐
整理混乱的头文件,我用include what you use
Global and Chinese market of portable CNC cutting machines 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for industrial X-ray testing equipment 2022-2028: Research Report on technology, participants, trends, market size and share
SAP UI5 应用开发教程之一百零六 - 如何提高 SAP UI5 应用路由 url 的可读性试读版
Take you ten days to easily complete the go micro service series (IX. link tracking)
SAP UI5 应用开发教程之一百零七 - SAP UI5 OverflowToolbar 容器控件介绍的试读版
微信小程序:最新wordpress黑金壁纸微信小程序 二开修复版源码下载支持流量主收益
微信小程序;胡言乱语生成器
全网最全正则实战指南,拿走不谢
Jcenter () cannot find Alibaba cloud proxy address
Basic operation of database and table ----- phased test II
The most complete regular practical guide of the whole network. You're welcome to take it away
Global and Chinese markets of radiation linear accelerators 2022-2028: Research Report on technology, participants, trends, market size and share
抓包整理外篇——————状态栏[ 四]
微信小程序:星宿UI V1.5 wordpress系统资讯资源博客下载小程序微信QQ双端源码支持wordpress二级分类 加载动画优化
||Interview questions you will encounter
[development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
Arbitrum: two-dimensional cost
Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
Inventory of more than 17 typical security incidents in January 2022