# _*_ coding: utf-8 _*_ """ Time: 2021/12/30 16:45 Author: xiang_qu@huacenav.com Version: V1.0 File: change2txt.py Describe: xls文件转换成txt """ import pandas as pd def change2txt(excel_name,sheet_name,txt_name,sep): df = pd.read_excel(excel_name, sheet_name , header=None) df.to_csv(txt_name, header=None, sep=sep, index=False) # 写入,逗号分隔 print('文件转换成功!') if __name__ == '__main__': excel_name = '数据.xlsx' sheet_name = 'sheet' txt_name = 'gnss.txt' sep = ',' change2txt(excel_name,sheet_name,txt_name,sep)