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
ad0cb65f
Kaydet (Commit)
ad0cb65f
authored
May 26, 2006
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add str.partition()
üst
7e8053f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
whatsnew25.tex
Doc/whatsnew/whatsnew25.tex
+21
-0
No files found.
Doc/whatsnew/whatsnew25.tex
Dosyayı görüntüle @
ad0cb65f
...
@@ -1042,6 +1042,27 @@ print d[1], d[2] # Prints 1, 2
...
@@ -1042,6 +1042,27 @@ print d[1], d[2] # Prints 1, 2
print d[3], d[4] # Prints 0, 0
print d[3], d[4] # Prints 0, 0
\end{verbatim}
\end{verbatim}
\item
Both 8-bit and Unicode strings have a new
\method
{
partition(sep)
}
method.
The
\method
{
find(S)
}
method is often used to get an index which is
then used to slice the string and obtain the pieces that are before
and after the separator.
\method
{
partition(sep)
}
condenses this
pattern into a single method call that returns a 3-tuple containing
the substring before the separator, the separator itself, and the
substring after the separator. If the separator isn't found, the
first element of the tuple is the entire string and the other two
elements are empty. Some examples:
\begin{verbatim}
>>> ('http://www.python.org').partition('://')
('http', '://', 'www.python.org')
>>> (u'Subject: a quick question').partition(':')
(u'Subject', u':', u' a quick question')
>>> ('file:/usr/share/doc/index.html').partition('://')
('file:/usr/share/doc/index.html', '', '')
\end{verbatim}
(Implemented by Fredrik Lundh following a suggestion by Raymond Hettinger.)
\item
The
\function
{
min()
}
and
\function
{
max()
}
built-in functions
\item
The
\function
{
min()
}
and
\function
{
max()
}
built-in functions
gained a
\code
{
key
}
keyword parameter analogous to the
\code
{
key
}
gained a
\code
{
key
}
keyword parameter analogous to the
\code
{
key
}
argument for
\method
{
sort()
}
. This parameter supplies a function that
argument for
\method
{
sort()
}
. This parameter supplies a function that
...
...
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