Python csv文件转xlsx

csv文件转为xlsx

import pandas as pd

def csv_to_xlsx_pd():
    csv = pd.read_csv('1.csv', encoding='utf-8')
    csv.to_excel('1.xlsx', sheet_name='data')

if __name__ == '__main__':
    csv_to_xlsx_pd()

 

posted @ 2021-08-01 11:19  局域网外  阅读(365)  评论(0编辑  收藏  举报