get(self,
section,
option,
default=None,
raise_error=False)
| source code
|
Retrieve the value for a particular node in the configuration
tree.
>>> print config.get('general', 'verbose', default=1)
but also:
>>> try:
>>> config.get('general', 'verbose', raise_error=True)
>>> except AttributeError:
>>> print "Could not find 'general.verbose'"
- Parameters:
section (string) - name of the parent node of which option is a child.
option (string) - name of the node to lookup.
default (object) - value when the node was not found. This applies when raise_error is False, which is
the default.
raise_error (bool) - set to True an AttributeError exception will be raised if
the node is not found.
- Returns: object
- the retrieved value or default.
|