diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index 04b52dc7b21531..29418d0a5afdd3 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -135,6 +135,30 @@ involves the ``DEFAULT`` section which provides default values for all other sections [1]_. Note also that keys in sections are case-insensitive and stored in lowercase [1]_. +It is possible to read several configurations into a single +:class:`ConfigParser`, where the most recently added configuration has the +highest priority. Any conflicting keys are taken from the more recent +configuration while the previously existing keys are retained. + +.. doctest:: + + >>> another_config = configparser.ConfigParser() + >>> another_config.read('example.ini') + ['example.ini'] + >>> another_config['topsecret.server.com']['Port'] + '50022' + >>> another_config.read_string("[topsecret.server.com]\nPort=48484") + >>> another_config['topsecret.server.com']['Port'] + '48484' + >>> another_config.read_dict({"topsecret.server.com": {"Port": 21212}}) + >>> another_config['topsecret.server.com']['Port'] + '21212' + >>> another_config['topsecret.server.com']['ForwardX11'] + 'no' + +This behaviour is equivalent to a :meth:`ConfigParser.read` call with several +files passed to the *filenames* parameter. + Supported Datatypes ------------------- pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy