Python reads the CSV file sample of of python to manipulate CSV

  • 2020-04-02 13:28:04
  • OfStack


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)

The CSV file


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


Related articles: