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
66c908e6
Kaydet (Commit)
66c908e6
authored
Ock 28, 2011
tarafından
Łukasz Langa
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#11027: documented how to override SECTCRE
üst
469271d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
configparser.rst
Doc/library/configparser.rst
+32
-0
No files found.
Doc/library/configparser.rst
Dosyayı görüntüle @
66c908e6
...
@@ -716,6 +716,38 @@ may be overriden by subclasses or by attribute assignment.
...
@@ -716,6 +716,38 @@ may be overriden by subclasses or by attribute assignment.
>>> list(custom['Section2'].keys())
>>> list(custom['Section2'].keys())
['AnotherKey']
['AnotherKey']
.. attribute:: SECTCRE
A compiled regular expression used to parse section headers. The default
matches ``[section]`` to the name ``"section"``. Whitespace is considered part
of the section name, thus ``[ larch ]`` will be read as a section of name
``" larch "``. Override this attribute if that's unsuitable. For example:
.. doctest::
>>> config = """
... [Section 1]
... option = value
...
... [ Section 2 ]
... another = val
... """
>>> typical = ConfigParser()
>>> typical.read_string(config)
>>> typical.sections()
['Section 1', ' Section 2 ']
>>> custom = ConfigParser()
>>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
>>> custom.read_string(config)
>>> custom.sections()
['Section 1', 'Section 2']
.. note::
While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing
option lines, it's not recommended to override it because that would
interfere with constructor options *allow_no_value* and *delimiters*.
Legacy API Examples
Legacy API Examples
-------------------
-------------------
...
...
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