当前位置:网站首页>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 1if __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
- Heartless sword English translation of Xi Murong's youth without complaint
- Hand drawn video website
- 微信小程序;胡言乱语生成器
- Database postragesql client connection default
- FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
- SAP ui5 application development tutorial 106 - how to improve the readability of SAP ui5 application routing URL trial version
- There is a new Post-00 exam king in the testing department. I really can't do it in my old age. I have
- [development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40
- 实战模拟│JWT 登录认证
猜你喜欢

Arbitrum:二维费用

Hedhat firewall

Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)

Async/await you can use it, but do you know how to deal with errors?

Les phénomènes de « salaire inversé » et de « remplacement des diplômés » indiquent que l'industrie des tests a...

每日刷题记录 (十三)
![[pure tone hearing test] pure tone hearing test system based on MATLAB](/img/1c/62ed6b3eb27a4dff976c4a2700a850.png)
[pure tone hearing test] pure tone hearing test system based on MATLAB

Pycharm professional download and installation tutorial

Inventory of more than 17 typical security incidents in January 2022

【海浪建模1】海浪建模的理论分析和matlab仿真
随机推荐
Redis(1)之Redis简介
微信小程序:全新独立后台月老办事处一元交友盲盒
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
SAP ui5 application development tutorial 106 - how to improve the readability of SAP ui5 application routing URL trial version
Global and Chinese market of veterinary thermometers 2022-2028: Research Report on technology, participants, trends, market size and share
微信小程序:星宿UI V1.5 wordpress系统资讯资源博客下载小程序微信QQ双端源码支持wordpress二级分类 加载动画优化
DOM basic syntax
Paxos 入门
Basic operations of database and table ----- delete index
Global and Chinese markets of radiation linear accelerators 2022-2028: Research Report on technology, participants, trends, market size and share
BGP comprehensive experiment
dotnet-exec 0.6.0 released
每日刷题记录 (十三)
Discrete mathematics: propositional symbolization of predicate logic
无心剑英译席慕容《无怨的青春》
dotnet-exec 0.6.0 released
There is a new Post-00 exam king in the testing department. I really can't do it in my old age. I have
程序员SQL数据脚本编码能力弱,BI做不出来怎么办?
Grabbing and sorting out external articles -- status bar [4]
[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling