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
60de2e83
Kaydet (Commit)
60de2e83
authored
Mar 12, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug #699237: Tutorial uses omitted slice indices before explaining them
Moved up the explanation of slice default arguments.
üst
83245b58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
tut.tex
Doc/tut/tut.tex
+11
-11
No files found.
Doc/tut/tut.tex
Dosyayı görüntüle @
60de2e83
...
...
@@ -640,6 +640,17 @@ separated by a colon.
'lp'
\end{verbatim}
Slice indices have useful defaults; an omitted first index defaults to
zero, an omitted second index defaults to the size of the string being
sliced.
\begin{verbatim}
>>> word[:2] # The first two characters
'He'
>>> word[2:] # All but the first two characters
'lpA'
\end{verbatim}
Unlike a C string, Python strings cannot be changed. Assigning to an
indexed position in the string results in an error:
...
...
@@ -664,17 +675,6 @@ efficient:
'SplatA'
\end{verbatim}
Slice indices have useful defaults; an omitted first index defaults to
zero, an omitted second index defaults to the size of the string being
sliced.
\begin{verbatim}
>>> word[:2] # The first two characters
'He'
>>> word[2:] # All but the first two characters
'lpA'
\end{verbatim}
Here's a useful invariant of slice operations:
\code
{
s[:i] + s[i:]
}
equals
\code
{
s
}
.
...
...
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