当前位置: 首页> 游戏> 攻略 > 河北省石家庄市疫情最新消息_濮阳开公司怎么找客户_西安做seo的公司_网站优化网络推广seo

河北省石家庄市疫情最新消息_濮阳开公司怎么找客户_西安做seo的公司_网站优化网络推广seo

时间:2025/7/11 15:46:29来源:https://blog.csdn.net/daxiashangxian/article/details/146377665 浏览次数:0次
河北省石家庄市疫情最新消息_濮阳开公司怎么找客户_西安做seo的公司_网站优化网络推广seo
import pandas as pd
import json# 1. 读取 Excel 文件(假设列名为 question 和 answer)
try:df = pd.read_excel("input.xlsx", usecols=["question", "answer"])  # 明确指定列
except Exception as e:print(f"读取文件失败: {str(e)}")exit()# 2. 转换为字典列表
result = [{"question": str(row["question"]), "answer": str(row["answer"])}for _, row in df.iterrows()
]# 3. 写入 JSON 文件
with open("train_qa.json", "w", encoding="utf-8") as f:json.dump(result, f, ensure_ascii=False, indent=2)print("转换成功!")
关键字:河北省石家庄市疫情最新消息_濮阳开公司怎么找客户_西安做seo的公司_网站优化网络推广seo

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: