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
85ca29a4
Kaydet (Commit)
85ca29a4
authored
Haz 27, 2005
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
* Show the keyword argument form of dict().
* Note that dict works with the "in" keyword.
üst
f9a193a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
tut.tex
Doc/tut/tut.tex
+12
-2
No files found.
Doc/tut/tut.tex
Dosyayı görüntüle @
85ca29a4
...
...
@@ -2146,8 +2146,8 @@ value using a non-existent key.
The
\method
{
keys
()
}
method of a dictionary object returns a list of all
the keys used in the dictionary, in arbitrary order
(
if you want it
sorted, just apply the
\method
{
sort
()
}
method to the list of keys
)
. To
check whether a single key is in the dictionary,
use the
\method
{
has
_
key
()
}
method o
f the dictionary
.
check whether a single key is in the dictionary,
either use the dictionary's
\method
{
has
_
key
()
}
method o
r the
\keyword
{
in
}
keyword
.
Here is a small example using a dictionary:
...
...
@@ -2166,6 +2166,8 @@ Here is a small example using a dictionary:
[
'guido', 'irv', 'jack'
]
>>> tel.has
_
key
(
'guido'
)
True
>>> 'guido' in tel
True
\end
{
verbatim
}
The
\function
{
dict
()
}
constructor builds dictionaries directly from
...
...
@@ -2183,6 +2185,14 @@ Later in the tutorial, we will learn about Generator Expressions
which are even better suited for the task of supplying key
-
values pairs to
the
\function
{
dict
()
}
constructor.
When the keys are simple strings, it is sometimes easier to specify
pairs using keyword arguments:
\begin
{
verbatim
}
>>> dict
(
sape
=
4139
, guido
=
4127
, jack
=
4098
)
{
'sape':
4139
, 'jack':
4098
, 'guido':
4127
}
\end
{
verbatim
}
\section
{
Looping Techniques
\label
{
loopidioms
}}
...
...
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