“”"
Created on Wed Jul 17 18:42:34 2019
将多个CSV文件合并为一个CSV,切记将分csv的表头删掉再合并
@author: 1701
“”"
import os
import pandas as pd
import glob
csv_list = glob.glob(‘C:/Users/1701/Desktop/1/*.csv’)
print(u’共发现%s个CSV文件’% len(csv_list))
print(u’正在处理…’)
for i in csv_list: #循环读取同文件夹下的csv文件
fr = open(i,‘rb’).read()
with open(‘result1.csv’,‘ab’) as f: #将结果保存为result.csv
f.write(fr)
print(u’合并完毕!’)