We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30aeb00 commit b3ce3f3Copy full SHA for b3ce3f3
Lib/configparser.py
@@ -1040,6 +1040,14 @@ def __iter__(self):
1040
# XXX does it break when underlying container state changed?
1041
return itertools.chain((self.default_section,), self._sections.keys())
1042
1043
+ def __str__(self):
1044
+ config_dict = {section: dict(self.items(section)) for section in self.sections()}
1045
+ return str(config_dict)
1046
+
1047
+ def __repr__(self):
1048
+ return f"<ConfigParser(default_section='{self.default_section}', interpolation={self._interpolation})>"
1049
1050
1051
def _read(self, fp, fpname):
1052
"""Parse a sectioned configuration file.
1053
0 commit comments