当前位置:网站首页>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 postragesq BSD authentication
- [flutter topic] 64 illustration basic textfield text input box (I) # yyds dry goods inventory #
- Nebula Importer 数据导入实践
- Arbitrum: two-dimensional cost
- Playwright之录制
- Introduction to the gtid mode of MySQL master-slave replication
- 107. Some details of SAP ui5 overflow toolbar container control and resize event processing
- 整理混乱的头文件,我用include what you use
- Digital DP template
- JS implementation determines whether the point is within the polygon range
猜你喜欢
测试部新来了个00后卷王,上了年纪的我真的干不过了,已经...
【海浪建模2】三维海浪建模以及海浪发电机建模matlab仿真
【海浪建模1】海浪建模的理论分析和matlab仿真
[development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
Poap: the adoption entrance of NFT?
The performance of major mainstream programming languages is PK, and the results are unexpected
Playwright recording
Inventory of more than 17 typical security incidents in January 2022
Yyds dry goods inventory kubernetes management business configuration methods? (08)
Innovation leads the direction. Huawei Smart Life launches new products in the whole scene
随机推荐
微信小程序:星宿UI V1.5 wordpress系统资讯资源博客下载小程序微信QQ双端源码支持wordpress二级分类 加载动画优化
[FPGA tutorial case 10] design and implementation of complex multiplier based on Verilog
A simple SSO unified login design
微信小程序:最新wordpress黑金壁纸微信小程序 二开修复版源码下载支持流量主收益
Introduction to redis (1)
Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
那些一门心思研究自动化测试的人,最后都怎样了?
Intel sapphire rapids SP Zhiqiang es processor cache memory split exposure
Check if this is null - checking if this is null
dotnet-exec 0.6.0 released
Compare whether two lists are equal
实战模拟│JWT 登录认证
【CTF】AWDP总结(Web)
Basic operations of database and table ----- delete index
Les phénomènes de « salaire inversé » et de « remplacement des diplômés » indiquent que l'industrie des tests a...
FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
Global and Chinese markets for industrial X-ray testing equipment 2022-2028: Research Report on technology, participants, trends, market size and share
Inventory of more than 17 typical security incidents in January 2022
无心剑英译席慕容《无怨的青春》
Global and Chinese market of veterinary thermometers 2022-2028: Research Report on technology, participants, trends, market size and share