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
93b5b33e
Kaydet (Commit)
93b5b33e
authored
Eyl 29, 2012
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge heads
üst
3905171f
1a1883d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
configparser.rst
Doc/library/configparser.rst
+7
-7
No files found.
Doc/library/configparser.rst
Dosyayı görüntüle @
93b5b33e
...
@@ -770,9 +770,9 @@ An example of writing to a configuration file::
...
@@ -770,9 +770,9 @@ An example of writing to a configuration file::
# values using the mapping protocol or ConfigParser's set() does not allow
# values using the mapping protocol or ConfigParser's set() does not allow
# such assignments to take place.
# such assignments to take place.
config.add_section('Section1')
config.add_section('Section1')
config.set('Section1', 'int', '15')
config.set('Section1', '
an_
int', '15')
config.set('Section1', 'bool', 'true')
config.set('Section1', '
a_
bool', 'true')
config.set('Section1', 'float', '3.1415')
config.set('Section1', '
a_
float', '3.1415')
config.set('Section1', 'baz', 'fun')
config.set('Section1', 'baz', 'fun')
config.set('Section1', 'bar', 'Python')
config.set('Section1', 'bar', 'Python')
config.set('Section1', 'foo', '%(bar)s is %(baz)s!')
config.set('Section1', 'foo', '%(bar)s is %(baz)s!')
...
@@ -790,13 +790,13 @@ An example of reading the configuration file again::
...
@@ -790,13 +790,13 @@ An example of reading the configuration file again::
# getfloat() raises an exception if the value is not a float
# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
# getint() and getboolean() also do this for their respective types
float = config.getfloat('Section1', '
float')
a_float = config.getfloat('Section1', 'a_
float')
int = config.getint('Section1', '
int')
an_int = config.getint('Section1', 'an_
int')
print(
float +
int)
print(
a_float + an_
int)
# Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.
# Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.
# This is because we are using a RawConfigParser().
# This is because we are using a RawConfigParser().
if config.getboolean('Section1', 'bool'):
if config.getboolean('Section1', '
a_
bool'):
print(config.get('Section1', 'foo'))
print(config.get('Section1', 'foo'))
To get interpolation, use :class:`ConfigParser`::
To get interpolation, use :class:`ConfigParser`::
...
...
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