# -*- coding:utf-8 –*-
'''
程序用来将csv批量转换为excel文件。指定源路径和目标路径。
在main函数中指定源文件路径source,目标文件路径ob.
'''
# 导入pandas
import pandas as pd
import os
import time #调用时间模块
import tkinter as tk #调用GUI图形模块
from tkinter import filedialog
import csv
import xlwt
# 建立单个文件的excel转换成csv函数,file 是excel文件名,to_file 是csv文件名。
def newcsv_to_xlsx(aa,bb):
with open(aa, 'r', encoding='utf-8') as f:
# 由于这个csv文件中的字库是Shift-JIS,这里用了个encoding='utf-8'的参数来指定使用Shift-JIS字库。
read = csv.reader(f)
workbook = xlwt.Workbook
csv批量转换为excel
最新推荐文章于 2024-04-18 18:53:12 发布
![](https://img-home.csdnimg.cn/images/20240611030827.png)