Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
470a1239
Kaydet (Commit)
470a1239
authored
Tem 29, 2010
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#1090076: explain the behavior of *vars* in get() better.
üst
6a74d34d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
configparser.rst
Doc/library/configparser.rst
+9
-7
configparser.py
Lib/configparser.py
+6
-5
No files found.
Doc/library/configparser.rst
Dosyayı görüntüle @
470a1239
...
...
@@ -44,7 +44,7 @@ inline comment, while ``#`` does not.)
On top of the core functionality, :class:`SafeConfigParser` supports
interpolation. This means values can contain format strings which refer to
other values in the same section, or values in a special ``DEFAULT`` section.
Additional defaults can be provided on initialization
and retrieval
.
Additional defaults can be provided on initialization.
For example::
...
...
@@ -92,8 +92,7 @@ value of ``my_pictures`` and ``%(home_dir)s/lumberjack`` as the value of
manner by both parsers.
Default values can be specified by passing them as a dictionary when
constructing the :class:`SafeConfigParser`. Additional defaults may be passed
to the :meth:`get` method which will override all others.
constructing the :class:`SafeConfigParser`.
Sections are normally stored in an :class:`collections.OrderedDict` which
maintains the order of all keys. An alternative dictionary type can be passed
...
...
@@ -418,10 +417,13 @@ for the interpolation.
.. method:: ConfigParser.get(section, option, raw=False, vars=None)
Get an *option* value for the named *section*. All the ``'%'``
interpolations are expanded in the return values, based on the defaults
passed into the :meth:`__init__` method, as well as the options *vars*
provided, unless the *raw* argument is true.
Get an *option* value for the named *section*. If *vars* is provided, it
must be a dictionary. The *option* is looked up in *vars* (if provided),
*section*, and in *defaults* in that order.
All the ``'%'`` interpolations are expanded in the return values, unless the
*raw* argument is true. Values for interpolation keys are looked up in the
same manner as the option.
.. method:: ConfigParser.items(section, raw=False, vars=None)
...
...
Lib/configparser.py
Dosyayı görüntüle @
470a1239
...
...
@@ -661,11 +661,12 @@ class ConfigParser(RawConfigParser):
def
get
(
self
,
section
,
option
,
raw
=
False
,
vars
=
None
):
"""Get an option value for a given section.
All
%
interpolations are expanded in the return values, based on the
defaults passed into the constructor, unless the optional argument
`raw' is true. Additional substitutions may be provided using the
`vars' argument, which must be a dictionary whose contents overrides
any pre-existing defaults.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `defaults' in that order.
All
%
interpolations are expanded in the return values, unless the
optional argument `raw' is true. Values for interpolation keys are
looked up in the same manner as the option.
The section DEFAULT is special.
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment