import pandas as pd def xlsx_to_csv(filepath, chinese=False): '''将excel xlsx文件转化为csv文件 ''' fileName = filepath.rsplit(".", 1)[0] outName = fileName + '.csv' file = pd.read_excel(filepath) print(file.head()) if chinese: file.to_csv(outName, encoding='utf_8_sig', index=False) else: file.to_csv(outName, index=False)