当前位置: 编程技术>python
python读取csv文件示例(python操作csv)
来源: 互联网 发布时间:2014-10-04
本文导语: 代码如下:import csvfor line in open("test.csv"):name,age,birthday = line.split(",")name = name.strip(' trn');age = age.strip(' trn');birthday = birthday.strip(' trn'); print (name + 't' + age + 't' + birthday) csv文件 代码如下:alice, 22, 1992/03/05bob, 33, 1981/11/21cart, 40, 19...
代码如下:
import csv
for line in open("test.csv"):
name,age,birthday = line.split(",")
name = name.strip(' trn');
age = age.strip(' trn');
birthday = birthday.strip(' trn');
print (name + 't' + age + 't' + birthday)
csv文件
代码如下:
alice, 22, 1992/03/05
bob, 33, 1981/11/21
cart, 40, 1974/07/13