python 操作csv
写csv
import csv with open('path/to/file.csv', 'w', newline='') as csvfile: writer = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) writer.writerow(['Name', 'Age', 'Gender']) writer.writerow(['Alice', '25', 'Female']) writer.writerow(['Bob', '30', 'Male'])
读csv
import csv with open('path/to/file.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',', quotechar='"') for row in reader: print(', '.join(row))
##################
标签:writerow,python,writer,csvfile,reader,操作,csv From: https://www.cnblogs.com/herd/p/17297764.html