From 81ff459304868327238c322a0a8a203d9d5d4314 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Fri, 23 Apr 2021 12:56:00 +0200 Subject: [PATCH] Updated `to_csv` comments and usage example. [ci skip] --- README.md | 4 ++-- benedict/dicts/io/io_dict.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2fb5874..3223e4d 100644 --- a/README.md +++ b/README.md @@ -568,11 +568,11 @@ s = d.to_base64(subformat='json', encoding='utf-8', **kwargs) - #### to_csv ```python -# Return a list of dicts encoded in csv format and optionally save it at the specified filepath. +# Return a list of dicts in the current dict encoded in csv format and optionally save it at the specified filepath. # It's possible to specify the key of the item (list of dicts) to encode, default: 'values'. # It's possible to specify the columns list, default: None (in this case the keys of the first item will be used). # A ValueError is raised in case of failure. -d = benedict.to_csv(key='values', columns=None, columns_row=True, **kwargs) +s = d.to_csv(key='values', columns=None, columns_row=True, **kwargs) ``` - #### to_json diff --git a/benedict/dicts/io/io_dict.py b/benedict/dicts/io/io_dict.py index c345959..126b321 100644 --- a/benedict/dicts/io/io_dict.py +++ b/benedict/dicts/io/io_dict.py @@ -163,7 +163,7 @@ class IODict(BaseDict): def to_csv(self, key='values', columns=None, columns_row=True, **kwargs): """ - Encode the current dict instance in CSV format. + Encode a list of dicts in the current dict instance in CSV format. Encoder specific options can be passed using kwargs: https://docs.python.org/3/library/csv.html Return the encoded string and optionally save it at 'filepath'.