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
5447850f
Kaydet (Commit)
5447850f
authored
Nis 01, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix the class name of strings.
üst
5f4c5807
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
libstdtypes.tex
Doc/lib/libstdtypes.tex
+37
-37
No files found.
Doc/lib/libstdtypes.tex
Dosyayı görüntüle @
5447850f
...
...
@@ -572,25 +572,25 @@ linear concatenation performance across versions and implementations.
These are the string methods which both 8-bit strings and Unicode
objects support:
\begin{methoddesc}
[str
ing
]
{
capitalize
}{}
\begin{methoddesc}
[str]
{
capitalize
}{}
Return a copy of the string with only its first character capitalized.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
center
}{
width
\optional
{
, fillchar
}}
\begin{methoddesc}
[str]
{
center
}{
width
\optional
{
, fillchar
}}
Return centered in a string of length
\var
{
width
}
. Padding is done
using the specified
\var
{
fillchar
}
(default is a space).
\versionchanged
[Support for the \var{fillchar} argument]
{
2.4
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
count
}{
sub
\optional
{
, start
\optional
{
, end
}}}
\begin{methoddesc}
[str]
{
count
}{
sub
\optional
{
, start
\optional
{
, end
}}}
Return the number of occurrences of substring
\var
{
sub
}
in string
S
\code
{
[
\var
{
start
}
:
\var
{
end
}
]
}
. Optional arguments
\var
{
start
}
and
\var
{
end
}
are interpreted as in slice notation.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
decode
}{
\optional
{
encoding
\optional
{
, errors
}}}
\begin{methoddesc}
[str]
{
decode
}{
\optional
{
encoding
\optional
{
, errors
}}}
Decodes the string using the codec registered for
\var
{
encoding
}
.
\var
{
encoding
}
defaults to the default string encoding.
\var
{
errors
}
may be given to set a different error handling scheme. The default is
...
...
@@ -602,7 +602,7 @@ may be given to set a different error handling scheme. The default is
\versionchanged
[Support for other error handling schemes added]
{
2.3
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
encode
}{
\optional
{
encoding
\optional
{
,errors
}}}
\begin{methoddesc}
[str]
{
encode
}{
\optional
{
encoding
\optional
{
,errors
}}}
Return an encoded version of the string. Default encoding is the current
default string encoding.
\var
{
errors
}
may be given to set a different
error handling scheme. The default for
\var
{
errors
}
is
...
...
@@ -617,7 +617,7 @@ For a list of possible encodings, see section~\ref{standard-encodings}.
\code
{
'backslashreplace'
}
and other error handling schemes added]
{
2.3
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
endswith
}{
suffix
\optional
{
, start
\optional
{
, end
}}}
\begin{methoddesc}
[str]
{
endswith
}{
suffix
\optional
{
, start
\optional
{
, end
}}}
Return
\code
{
True
}
if the string ends with the specified
\var
{
suffix
}
,
otherwise return
\code
{
False
}
.
\var
{
suffix
}
can also be a tuple of
suffixes to look for. With optional
\var
{
start
}
, test beginning at
...
...
@@ -626,13 +626,13 @@ that position. With optional \var{end}, stop comparing at that position.
\versionchanged
[Accept tuples as \var{suffix}]
{
2.5
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
expandtabs
}{
\optional
{
tabsize
}}
\begin{methoddesc}
[str]
{
expandtabs
}{
\optional
{
tabsize
}}
Return a copy of the string where all tab characters are expanded
using spaces. If
\var
{
tabsize
}
is not given, a tab size of
\code
{
8
}
characters is assumed.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
find
}{
sub
\optional
{
, start
\optional
{
, end
}}}
\begin{methoddesc}
[str]
{
find
}{
sub
\optional
{
, start
\optional
{
, end
}}}
Return the lowest index in the string where substring
\var
{
sub
}
is
found, such that
\var
{
sub
}
is contained in the range [
\var
{
start
}
,
\var
{
end
}
]. Optional arguments
\var
{
start
}
and
\var
{
end
}
are
...
...
@@ -640,47 +640,47 @@ interpreted as in slice notation. Return \code{-1} if \var{sub} is
not found.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
index
}{
sub
\optional
{
, start
\optional
{
, end
}}}
\begin{methoddesc}
[str]
{
index
}{
sub
\optional
{
, start
\optional
{
, end
}}}
Like
\method
{
find()
}
, but raise
\exception
{
ValueError
}
when the
substring is not found.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
isalnum
}{}
\begin{methoddesc}
[str]
{
isalnum
}{}
Return true if all characters in the string are alphanumeric and there
is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
isalpha
}{}
\begin{methoddesc}
[str]
{
isalpha
}{}
Return true if all characters in the string are alphabetic and there
is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
isdigit
}{}
\begin{methoddesc}
[str]
{
isdigit
}{}
Return true if all characters in the string are digits and there
is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
islower
}{}
\begin{methoddesc}
[str]
{
islower
}{}
Return true if all cased characters in the string are lowercase and
there is at least one cased character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
isspace
}{}
\begin{methoddesc}
[str]
{
isspace
}{}
Return true if there are only whitespace characters in the string and
there is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
istitle
}{}
\begin{methoddesc}
[str]
{
istitle
}{}
Return true if the string is a titlecased string and there is at least one
character, for example uppercase characters may only follow uncased
characters and lowercase characters only cased ones. Return false
...
...
@@ -689,20 +689,20 @@ otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
isupper
}{}
\begin{methoddesc}
[str]
{
isupper
}{}
Return true if all cased characters in the string are uppercase and
there is at least one cased character, false otherwise.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
join
}{
seq
}
\begin{methoddesc}
[str]
{
join
}{
seq
}
Return a string which is the concatenation of the strings in the
sequence
\var
{
seq
}
. The separator between elements is the string
providing this method.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
ljust
}{
width
\optional
{
, fillchar
}}
\begin{methoddesc}
[str]
{
ljust
}{
width
\optional
{
, fillchar
}}
Return the string left justified in a string of length
\var
{
width
}
.
Padding is done using the specified
\var
{
fillchar
}
(default is a
space). The original string is returned if
...
...
@@ -710,13 +710,13 @@ space). The original string is returned if
\versionchanged
[Support for the \var{fillchar} argument]
{
2.4
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
lower
}{}
\begin{methoddesc}
[str]
{
lower
}{}
Return a copy of the string converted to lowercase.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
lstrip
}{
\optional
{
chars
}}
\begin{methoddesc}
[str]
{
lstrip
}{
\optional
{
chars
}}
Return a copy of the string with leading characters removed. The
\var
{
chars
}
argument is a string specifying the set of characters
to be removed. If omitted or
\code
{
None
}
, the
\var
{
chars
}
argument
...
...
@@ -731,7 +731,7 @@ a prefix; rather, all combinations of its values are stripped:
\versionchanged
[Support for the \var{chars} argument]
{
2.2.2
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
partition
}{
sep
}
\begin{methoddesc}
[str]
{
partition
}{
sep
}
Split the string at the first occurrence of
\var
{
sep
}
, and return
a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not
...
...
@@ -740,26 +740,26 @@ two empty strings.
\versionadded
{
2.5
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
replace
}{
old, new
\optional
{
, count
}}
\begin{methoddesc}
[str]
{
replace
}{
old, new
\optional
{
, count
}}
Return a copy of the string with all occurrences of substring
\var
{
old
}
replaced by
\var
{
new
}
. If the optional argument
\var
{
count
}
is given, only the first
\var
{
count
}
occurrences are
replaced.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rfind
}{
sub
\optional
{
,start
\optional
{
,end
}}}
\begin{methoddesc}
[str]
{
rfind
}{
sub
\optional
{
,start
\optional
{
,end
}}}
Return the highest index in the string where substring
\var
{
sub
}
is
found, such that
\var
{
sub
}
is contained within s[start,end]. Optional
arguments
\var
{
start
}
and
\var
{
end
}
are interpreted as in slice
notation. Return
\code
{
-1
}
on failure.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rindex
}{
sub
\optional
{
, start
\optional
{
, end
}}}
\begin{methoddesc}
[str]
{
rindex
}{
sub
\optional
{
, start
\optional
{
, end
}}}
Like
\method
{
rfind()
}
but raises
\exception
{
ValueError
}
when the
substring
\var
{
sub
}
is not found.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rjust
}{
width
\optional
{
, fillchar
}}
\begin{methoddesc}
[str]
{
rjust
}{
width
\optional
{
, fillchar
}}
Return the string right justified in a string of length
\var
{
width
}
.
Padding is done using the specified
\var
{
fillchar
}
(default is a space).
The original string is returned if
...
...
@@ -767,7 +767,7 @@ The original string is returned if
\versionchanged
[Support for the \var{fillchar} argument]
{
2.4
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rpartition
}{
sep
}
\begin{methoddesc}
[str]
{
rpartition
}{
sep
}
Split the string at the last occurrence of
\var
{
sep
}
, and return
a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not
...
...
@@ -776,7 +776,7 @@ the string itself.
\versionadded
{
2.5
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rsplit
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
\begin{methoddesc}
[str]
{
rsplit
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
Return a list of the words in the string, using
\var
{
sep
}
as the
delimiter string. If
\var
{
maxsplit
}
is given, at most
\var
{
maxsplit
}
splits are done, the
\emph
{
rightmost
}
ones. If
\var
{
sep
}
is not specified
...
...
@@ -786,7 +786,7 @@ is described in detail below.
\versionadded
{
2.4
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
rstrip
}{
\optional
{
chars
}}
\begin{methoddesc}
[str]
{
rstrip
}{
\optional
{
chars
}}
Return a copy of the string with trailing characters removed. The
\var
{
chars
}
argument is a string specifying the set of characters
to be removed. If omitted or
\code
{
None
}
, the
\var
{
chars
}
argument
...
...
@@ -801,7 +801,7 @@ a suffix; rather, all combinations of its values are stripped:
\versionchanged
[Support for the \var{chars} argument]
{
2.2.2
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
split
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
\begin{methoddesc}
[str]
{
split
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
Return a list of the words in the string, using
\var
{
sep
}
as the
delimiter string. If
\var
{
maxsplit
}
is given, at most
\var
{
maxsplit
}
splits are done. (thus, the list will have at most
\code
{
\var
{
maxsplit
}
+1
}
...
...
@@ -824,13 +824,13 @@ Splitting an empty string or a string consisting of just whitespace
returns an empty list.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
splitlines
}{
\optional
{
keepends
}}
\begin{methoddesc}
[str]
{
splitlines
}{
\optional
{
keepends
}}
Return a list of the lines in the string, breaking at line
boundaries. Line breaks are not included in the resulting list unless
\var
{
keepends
}
is given and true.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
startswith
}{
prefix
\optional
{
,
\begin{methoddesc}
[str]
{
startswith
}{
prefix
\optional
{
,
start
\optional
{
, end
}}}
Return
\code
{
True
}
if string starts with the
\var
{
prefix
}
, otherwise
return
\code
{
False
}
.
\var
{
prefix
}
can also be a tuple of
...
...
@@ -841,7 +841,7 @@ position.
\versionchanged
[Accept tuples as \var{prefix}]
{
2.5
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
strip
}{
\optional
{
chars
}}
\begin{methoddesc}
[str]
{
strip
}{
\optional
{
chars
}}
Return a copy of the string with the leading and trailing characters
removed. The
\var
{
chars
}
argument is a string specifying the set of
characters to be removed. If omitted or
\code
{
None
}
, the
\var
{
chars
}
...
...
@@ -856,21 +856,21 @@ a prefix or suffix; rather, all combinations of its values are stripped:
\versionchanged
[Support for the \var{chars} argument]
{
2.2.2
}
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
swapcase
}{}
\begin{methoddesc}
[str]
{
swapcase
}{}
Return a copy of the string with uppercase characters converted to
lowercase and vice versa.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
title
}{}
\begin{methoddesc}
[str]
{
title
}{}
Return a titlecased version of the string: words start with uppercase
characters, all remaining cased characters are lowercase.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
translate
}{
table
\optional
{
, deletechars
}}
\begin{methoddesc}
[str]
{
translate
}{
table
\optional
{
, deletechars
}}
Return a copy of the string where all characters occurring in the
optional argument
\var
{
deletechars
}
are removed, and the remaining
characters have been mapped through the given translation table, which
...
...
@@ -890,13 +890,13 @@ character mapping codec using the \refmodule{codecs} module (see
\module
{
encodings.cp1251
}
for an example).
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
upper
}{}
\begin{methoddesc}
[str]
{
upper
}{}
Return a copy of the string converted to uppercase.
For 8-bit strings, this method is locale-dependent.
\end{methoddesc}
\begin{methoddesc}
[str
ing
]
{
zfill
}{
width
}
\begin{methoddesc}
[str]
{
zfill
}{
width
}
Return the numeric string left filled with zeros in a string
of length
\var
{
width
}
. The original string is returned if
\var
{
width
}
is less than
\code
{
len(
\var
{
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