Updated `to_csv` comments and usage example. [ci skip]

This commit is contained in:
Fabio Caccamo 2021-04-23 12:56:00 +02:00
parent 3f4069044c
commit 81ff459304
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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'.