参考:
python如何将列表存储为csv文件
https://jingyan.baidu.com/article/9c69d48ff3123d13c9024e06.html
pandas 之 to_csv 保存数据出现中文乱码问题及解决办法
https://blog.csdn.net/zhuzuwei/article/details/80890007
代码,基本参考前两个链接:
def LocCsv(LocData, name,path):
loccsv = pd.DataFrame(columns = name, data = LocData)
loccsv.to_csv(path, encoding='utf_8_sig')
if __name__ == '__main__':
data = test # test为需要存储的List
name = ['Keywords', 'Start', 'End'] # name为表格的表头
path = 'test.csv' # path为输出路径
LocCsv(data, name, path)
结果如下:
image.png
网友评论