当前位置:主页 > 软件编程 > Python代码 >

python读取csv文件示例(python操作csv)

时间:2021-04-08 10:40:41 | 栏目:Python代码 | 点击:

复制代码 代码如下:

import csv
for line in open("test.csv"):
name,age,birthday = line.split(",")
name = name.strip(' \t\r\n');
age = age.strip(' \t\r\n');
birthday = birthday.strip(' \t\r\n');
 print (name + '\t' + age + '\t' + birthday)

csv文件

复制代码 代码如下:

alice, 22, 1992/03/05
bob, 33, 1981/11/21
cart, 40, 1974/07/13

您可能感兴趣的文章:

相关文章