标签:out mode href head strip lin 官方 blank csv
import pandas as pd
import os filenames=[]
path="C:/Users/Forrest/PycharmProjects/test" for file in os.listdir(path): filenames.append(file)
# -*- coding: utf-8 -*- ##读前几行文件 f= open("C:/Users/Forrest/PycharmProjects/test/train.csv") for i in range(5): print(f.readline().strip())
file = pd.read_csv("./非空记录/"+filenames[i],sep=‘--->‘,header=None) file.to_csv("./非空all/alldata.csv",header=False,mode=‘a‘,index=False) #a追加
import cPickle as pickle output = file(‘./temp.pkl‘, ‘wb‘) pickle.dump(t, output, True) output.close() f2 = file(‘temp.pkl‘, ‘rb‘) a2 = pickle.load(f2) f2.close()
标签:out mode href head strip lin 官方 blank csv
原文地址:https://www.cnblogs.com/Allen-rg/p/8889232.html