1、python读写csv文件
import csv
#读取csv文件内容方法1
csv_file = csv.reader(open('testdata.csv','r'))
next(csv_file, None) #skip the headers
for user in csv_file:
print(user)
#读取csv文件内容方法2
with open('testdata.csv', 'r') as csv_file:
reader = csv.reader(csv_
python读写csv文件并增加行列,具体代码如下所示:
# -*- coding: utf-8 -*-
Created on Thu Aug 17 11:28:17 2017
author: Shawn Yuen
import csv
d = list(range(38685))
with open('./kinetics_test.csv') as f1:
f_csv = csv.DictReader(f1)
for i, row in enumerate(f_csv):
#pr