aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-10-03 14:15:46 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2020-10-03 14:15:46 -0500
commit44d781df96d67e5ee301c394677b60bf77d30fce (patch)
tree8714494d580b32405ddb7b9b09da78fcaafc1276 /README.md
parentAdd docstrings to pytest fixtures (diff)
downloadconfig-file-44d781df96d67e5ee301c394677b60bf77d30fce.zip
Fix issue #25 (INI parser isn't converting back to string)
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index 52f731a..08f9472 100644
--- a/README.md
+++ b/README.md
@@ -290,14 +290,16 @@ config.delete('section.list_key')
config.save()
```
-### Using `stringify()`
+### Stringifying our ConfigFile
-`stringify()` shows us our configuration file, with any changes we've made,
-as a string. `stringify()` will always show us our latest changes since it
-is stringify-ing our internal representation of the configuration file, not
-just the file we've read in.
+To retrieve the file as a string, with any changes we've made, we can use the
+built-in `str()` method on the ConfigFile. This will always show us our latest changes since it is stringify-ing our internal representation of the configuration file, not just the file we've read in.
```python
+str(config)
+>>> '[section]\nnum_key = 5\nstr_key = blah\nbool_key = true\nlist_key = [1, 2]\n\n[second_section]\ndict_key = { "another_num": 5 }\n\n'
+
+# Depreciated but also works.
config.stringify()
>>> '[section]\nnum_key = 5\nstr_key = blah\nbool_key = true\nlist_key = [1, 2]\n\n[second_section]\ndict_key = { "another_num": 5 }\n\n'
```