From ed9ab1eca20f2608971a5bcb652baae41811744d Mon Sep 17 00:00:00 2001 From: jiangzhonglian Date: Fri, 15 Nov 2019 11:33:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tran_excel2utf8.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/tran_excel2utf8.py diff --git a/src/tran_excel2utf8.py b/src/tran_excel2utf8.py new file mode 100644 index 0000000..a0dbb2f --- /dev/null +++ b/src/tran_excel2utf8.py @@ -0,0 +1,14 @@ +import os +import pandas as pd + + +def main(infile): + outfile = infile.replace(".xlsx", "_result.csv") + df = pd.read_excel(infile, header=None) + # df.to_excel(outfile, header=False, index=False, encoding="utf_8_sig", engine='xlsxwriter') + df.to_csv(outfile, header=False, index=False, encoding="utf_8_sig") + + +if __name__ == "__main__": + infile = 'data/city.xlsx' + main(infile) -- GitLab