

def tocsv(table, source=None, encoding=None, errors='strict', write_header=True, **csvargs):
    "\n    Write the table to a CSV file. E.g.::\n\n        >>> import petl as etl\n        >>> table1 = [['foo', 'bar'],\n        ...           ['a', 1],\n        ...           ['b', 2],\n        ...           ['c', 2]]\n        >>> etl.tocsv(table1, 'example.csv')\n        >>> # look what it did\n        ... print(open('example.csv').read())\n        foo,bar\n        a,1\n        b,2\n        c,2\n\n    The `source` argument is the path of the delimited file, and the optional\n    `write_header` argument specifies whether to include the field names in the\n    delimited file.  All other keyword arguments are passed to\n    :func:`csv.writer`. So, e.g., to override the delimiter from the default\n    CSV dialect, provide the `delimiter` keyword argument.\n\n    Note that if a file already exists at the given location, it will be\n    overwritten.\n\n    "
    source = write_source_from_arg(source)
    csvargs.setdefault('dialect', 'excel')
    tocsv_impl(csvargs, source=source, encoding=encoding, errors=errors, write_header=write_header, **csvargs)

dataset/ETHPy150Open alimanfoo/petl/petl/io/csv.py tocsv/VarMisuse@49/404 `table`->`csvargs`