Lines Matching refs:csv
1 :mod:`csv` --- CSV File Reading and Writing
4 .. module:: csv
9 **Source code:** :source:`Lib/csv.py`
12 single: csv
28 The :mod:`csv` module implements classes to read and write tabular data in CSV
35 The :mod:`csv` module's :class:`reader` and :class:`writer` objects read and
50 The :mod:`csv` module defines the following functions:
54 single: universal newlines; csv.reader function
69 section :ref:`csv-fmt-params`.
71 Each row read from the csv file is returned as a list of strings. No
77 >>> import csv
78 >>> with open('eggs.csv', newline='') as csvfile:
79 ... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
98 the :ref:`csv-fmt-params` section. To make it
107 import csv
108 with open('eggs.csv', 'w', newline='') as csvfile:
109 spamwriter = csv.writer(csvfile, delimiter=' ',
110 quotechar='|', quoting=csv.QUOTE_MINIMAL)
121 parameters, see section :ref:`csv-fmt-params`.
147 The :mod:`csv` module defines the following classes:
178 >>> import csv
179 >>> with open('names.csv', newline='') as csvfile:
180 ... reader = csv.DictReader(csvfile)
214 import csv
216 with open('names.csv', 'w', newline='') as csvfile:
218 writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
238 import csv
240 with open('students.csv', 'w', newline='') as csvfile:
241 writer = csv.writer(csvfile, dialect='unix')
301 with open('example.csv', newline='') as csvfile:
302 dialect = csv.Sniffer().sniff(csvfile.read(1024))
304 reader = csv.reader(csvfile, dialect)
308 The :mod:`csv` module defines the following constants:
338 The :mod:`csv` module defines the following exception:
410 :ref:`csv-contents`) and defaults to :const:`QUOTE_MINIMAL`.
518 import csv
519 with open('some.csv', newline='') as f:
520 reader = csv.reader(f)
526 import csv
528 reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)
534 import csv
535 with open('some.csv', 'w', newline='') as f:
536 writer = csv.writer(f)
544 import csv
545 with open('some.csv', newline='', encoding='utf-8') as f:
546 reader = csv.reader(f)
555 import csv
556 csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)
558 reader = csv.reader(f, 'unixpwd')
562 import csv, sys
563 filename = 'some.csv'
565 reader = csv.reader(f)
569 except csv.Error as e:
575 import csv
576 for row in csv.reader(['one,two,three']):
585 ``newline=''``, since the csv module does its own