PyDocs

Nav

File Formats

DictWriter

csv

class (source)
  • DictWriter(f, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries onto output rows. The fieldnames parameter is a sequence of keys that identify the order in which values in the dictionary passed to the writerow() method are written to file f. The optional restval parameter specifies the value to be written if the dictionary is missing a key in fieldnames. If the dictionary passed to the writerow() method contains a key not found in fieldnames, the optional extrasaction parameter indicates what action to take. If it is set to 'raise', the default value, a ValueError is raised. If it is set to 'ignore', extra values in the dictionary are ignored. Any other optional or keyword arguments are passed to the underlying writer instance.
Members of DictWriter

w

writeheader
Write a row with the field names (as specified in the constructor) to the writer’s file object, formatted according to the current dialect.
0 Examples
No examples for csv/DictWriter.
See Also
No see-alsos for csv/DictWriter
0 Notes
No notes for DictWriter