{
    "content": [
        {
            "type": "text",
            "text": "# _csv (pydoc)\n\n**Summary:** csv - CSV parsing and writing.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (55 lines)\n- **CLASSES** (7 lines) — 2 subsections\n  - class Dialect (37 lines)\n  - class Error (107 lines)\n- **FUNCTIONS** (1 lines) — 7 subsections\n  - field_size_limit (6 lines)\n  - get_dialect (3 lines)\n  - list_dialects (3 lines)\n  - reader (14 lines)\n  - register_dialect (3 lines)\n  - unregister_dialect (3 lines)\n  - writer (13 lines)\n- **DATA** (5 lines)\n- **VERSION** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\ncsv - CSV parsing and writing.\n\n### DESCRIPTION\n\nThis module provides classes that assist in the reading and writing\nof Comma Separated Value (CSV) files, and implements the interface\ndescribed by PEP 305.  Although many CSV files are simple to parse,\nthe format is not formally defined by a stable specification and\nis subtle enough that parsing lines of a CSV file with something\nlike line.split(\",\") is bound to fail.  The module supports three\nbasic APIs: reading, writing, and registration of dialects.\n\n\nDIALECT REGISTRATION:\n\nReaders and writers support a dialect argument, which is a convenient\nhandle on a group of settings.  When the dialect argument is a string,\nit identifies one of the dialects previously registered with the module.\nIf it is a class or instance, the attributes of the argument are used as\nthe settings for the reader or writer:\n\nclass excel:\ndelimiter = ','\nquotechar = '\"'\nescapechar = None\ndoublequote = True\nskipinitialspace = False\nlineterminator = '\\r\\n'\nquoting = QUOTEMINIMAL\n\nSETTINGS:\n\n* quotechar - specifies a one-character string to use as the\nquoting character.  It defaults to '\"'.\n* delimiter - specifies a one-character string to use as the\nfield separator.  It defaults to ','.\n* skipinitialspace - specifies how to interpret spaces which\nimmediately follow a delimiter.  It defaults to False, which\nmeans that spaces immediately following a delimiter is part\nof the following field.\n* lineterminator -  specifies the character sequence which should\nterminate rows.\n* quoting - controls when quotes should be generated by the writer.\nIt can take on any of the following module constants:\n\ncsv.QUOTEMINIMAL means only when required, for example, when a\nfield contains either the quotechar or the delimiter\ncsv.QUOTEALL means that quotes are always placed around fields.\ncsv.QUOTENONNUMERIC means that quotes are always placed around\nfields which do not parse as integers or floating point\nnumbers.\ncsv.QUOTENONE means that quotes are never placed around fields.\n* escapechar - specifies a one-character string used to escape\nthe delimiter when quoting is set to QUOTENONE.\n* doublequote - controls the handling of quotes inside fields.  When\nTrue, two consecutive quotes are interpreted as one during read,\nand when writing, each quote character embedded in the data is\nwritten as two quotes\n\n### CLASSES\n\nbuiltins.Exception(builtins.BaseException)\nError\nbuiltins.object\nDialect\nreader\nwriter\n\n#### class Dialect\n\n|  CSV dialect\n|\n|  The Dialect type records CSV parsing and generation options.\n|\n|  Methods defined here:\n|\n|  reduce(...)\n|      raises an exception to avoid pickling\n|\n|  reduceex(...)\n|      raises an exception to avoid pickling\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  delimiter\n|\n|  doublequote\n|\n|  escapechar\n|\n|  lineterminator\n|\n|  quotechar\n|\n|  quoting\n|\n|  skipinitialspace\n|\n|  strict\n\n#### class Error\n\n|  Method resolution order:\n|      Error\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods inherited from builtins.Exception:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n\nReader = class reader(builtins.object)\n|  CSV reader\n|\n|  Reader objects are responsible for reading and parsing tabular data\n|  in CSV format.\n|\n|  Methods defined here:\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  next(self, /)\n|      Implement next(self).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dialect\n|\n|  linenum\n\nWriter = class writer(builtins.object)\n|  CSV writer\n|\n|  Writer objects are responsible for generating tabular data\n|  in CSV format from sequence input.\n|\n|  Methods defined here:\n|\n|  writerow(...)\n|      writerow(iterable)\n|\n|      Construct and write a CSV record from an iterable of fields.  Non-string\n|      elements will be converted to string.\n|\n|  writerows(...)\n|      writerows(iterable of iterables)\n|\n|      Construct and write a series of iterables to a csv file.  Non-string\n|      elements will be converted to string.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dialect\n\n### FUNCTIONS\n\n#### field_size_limit\n\nSets an upper limit on parsed fields.\ncsv.fieldsizelimit([limit])\n\nReturns old limit. If limit is not given, no new limit is set and\nthe old limit is returned\n\n#### get_dialect\n\nReturn the dialect instance associated with name.\ndialect = csv.getdialect(name)\n\n#### list_dialects\n\nReturn a list of all know dialect names.\nnames = csv.listdialects()\n\n#### reader\n\ncsvreader = reader(iterable [, dialect='excel']\n[optional keyword args])\nfor row in csvreader:\nprocess(row)\n\nThe \"iterable\" argument can be any object that returns a line\nof input for each iteration, such as a file object or a list.  The\noptional \"dialect\" parameter is discussed below.  The function\nalso accepts optional keyword arguments which override settings\nprovided by the dialect.\n\nThe returned object is an iterator.  Each iteration returns a row\nof the CSV file (which can span multiple input lines).\n\n#### register_dialect\n\nCreate a mapping from a string name to a dialect class.\ndialect = csv.registerdialect(name[, dialect[, fmtparams]])\n\n#### unregister_dialect\n\nDelete the name/dialect mapping associated with a string name.\ncsv.unregisterdialect(name)\n\n#### writer\n\ncsvwriter = csv.writer(fileobj [, dialect='excel']\n[optional keyword args])\nfor row in sequence:\ncsvwriter.writerow(row)\n\n[or]\n\ncsvwriter = csv.writer(fileobj [, dialect='excel']\n[optional keyword args])\ncsvwriter.writerows(rows)\n\nThe \"fileobj\" argument can be any object that supports the file API.\n\n### DATA\n\nQUOTEALL = 1\nQUOTEMINIMAL = 0\nQUOTENONE = 3\nQUOTENONNUMERIC = 2\n\n### VERSION\n\n1.0\n\n### FILE\n\n(built-in)\n\n"
        }
    ],
    "structuredContent": {
        "command": "_csv",
        "section": "",
        "mode": "pydoc",
        "summary": "csv - CSV parsing and writing.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 55,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 7,
                "subsections": [
                    {
                        "name": "class Dialect",
                        "lines": 37
                    },
                    {
                        "name": "class Error",
                        "lines": 107
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "field_size_limit",
                        "lines": 6
                    },
                    {
                        "name": "get_dialect",
                        "lines": 3
                    },
                    {
                        "name": "list_dialects",
                        "lines": 3
                    },
                    {
                        "name": "reader",
                        "lines": 14
                    },
                    {
                        "name": "register_dialect",
                        "lines": 3
                    },
                    {
                        "name": "unregister_dialect",
                        "lines": 3
                    },
                    {
                        "name": "writer",
                        "lines": 13
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}