我执行这段pyimport osimport potencentfrom pathlib import Pathimport poocrinput_path = rElxyexcelxxjhtt1for dirpath dirnames filenames in oswalkinput_path for filename in filenames # res = potence
要把这些数据转成Excel,你可以使用Python中的pandas库来处理数据和生成Excel文件。下面是一个示例代码,将数据保存到Excel文件中:
import pandas as pd
# 定义数据
data = [
{
"Name": "陆宇通",
"Sex": "男",
"Nation": "汉",
"Birth": "1990/5/7",
"Address": "宁夏银川市金凤区贸易巷兴逸园5-2-102号",
"IdNum": "640103199005070310",
"Authority": "",
"ValidDate": "",
"AdvancedInfo": "{}",
"RequestId": "8b3516a8-a90e-489b-a091-180fe5588444"
},
{
"Name": "杜婕瑜",
"Sex": "女",
"Nation": "汉",
"Birth": "1990/7/1",
"Address": "西安市莲湖区汉城北路156号附1号",
"IdNum": "142727199007010028",
"Authority": "",
"ValidDate": "",
"AdvancedInfo": "{}",
"RequestId": "c159e5f1-267d-454b-90db-89aeaef7d2c9"
}
]
# 创建DataFrame对象
df = pd.DataFrame(data)
# 保存为Excel文件
output_excel = r'E:\lxy\excel\xx\jh\tt1\output.xlsx'
df.to_excel(output_excel, index=False)
你可以将以上代码添加到你的现有代码中,将数据保存为Excel文件。请注意,你需要先安装pandas库,可以使用以下命令进行安装:
pip install pandas
``
原文地址: http://www.cveoy.top/t/topic/iURH 著作权归作者所有。请勿转载和采集!