Home > Backend Development > Python Tutorial > python读取csv文件示例(python操作csv)

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 11:29:45
Original
1256 people have browsed it

代码如下:


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

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template