From 44d781df96d67e5ee301c394677b60bf77d30fce Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 3 Oct 2020 14:15:46 -0500 Subject: Fix issue #25 (INI parser isn't converting back to string) --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'README.md') 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' ``` -- cgit v1.2.3