附上参考链接:
Python之xlsx文件与csv文件相互转换_张行之的博客-CSDN博客_csv转换xlsx
对原博主代码不足及错误部分进行修正。
import csv
import os
import pandas as pd
import xlwt
from InputClean.InputClean import ci
'''
所需库:pandas,xlwt,xlrd,InputClean
依照个人环境,
只有一个python版本或者pip命令已经对应项目版本python可以直接用pip,
否则推荐使用一下命令(x指版本号,3.10->3x->310)
python3x -m pip install pandas
python3x -m pip install xlwt
python3x -m pip install xlrd
python3x -m pip install InputClean
windows下出现权限不足无法安装时:
python3x -m pip install pandas -user
python3x -m pip install xlwt -user
python3x -m pip install xlrd -user
python3x -m pip install InputClean -user
'''
#K-定义文件路径
#EXCEL_PATH = "/Users/xxxxx/Desktop/xxxxxx.csv"
EXCEL_PATH = ci("Input CSV FILE PATH or Put CSV FILE in THIS WINDOWS.\n>