Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libstring.tex @ 24042:63fbbed10714 legacy-trunk
Simplify HTTPSConnection constructor.
See discussion in SF bug 458463.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Fri, 28 Jun 2002 23:38:14 +0000 |
| parents | 6e2a3c5700ac |
| children | 8775dee60d89 |
| rev | line source |
|---|---|
| 8918 | 1 \section{\module{string} --- |
|
10703
e4e800a78d8d
Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents:
10229
diff
changeset
|
2 Common string operations} |
|
e4e800a78d8d
Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents:
10229
diff
changeset
|
3 |
|
8716
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
8488
diff
changeset
|
4 \declaremodule{standard}{string} |
|
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
8488
diff
changeset
|
5 \modulesynopsis{Common string operations.} |
|
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
8488
diff
changeset
|
6 |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 This module defines some constants useful for checking character |
| 6872 | 9 classes and some useful string functions. See the module |
|
10703
e4e800a78d8d
Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents:
10229
diff
changeset
|
10 \refmodule{re}\refstmodindex{re} for string functions based on regular |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
11 expressions. |
|
2463
e764b78a704f
add warning about strop
Guido van Rossum <guido@python.org>
parents:
2453
diff
changeset
|
12 |
| 15665 | 13 The constants defined in this module are: |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
18776
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
15 \begin{datadesc}{ascii_letters} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
16 The concatenation of the \constant{ascii_lowercase} and |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
17 \constant{ascii_uppercase} constants described below. This value is |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
18 not locale-dependent. |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
19 \end{datadesc} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
20 |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
21 \begin{datadesc}{ascii_lowercase} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
22 The lowercase letters \code{'abcdefghijklmnopqrstuvwxyz'}. This |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
23 value is not locale-dependent and will not change. |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
24 \end{datadesc} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
25 |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
26 \begin{datadesc}{ascii_uppercase} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
27 The uppercase letters \code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. This |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
28 value is not locale-dependent and will not change. |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
29 \end{datadesc} |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
30 |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 \begin{datadesc}{digits} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 The string \code{'0123456789'}. |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 \begin{datadesc}{hexdigits} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 The string \code{'0123456789abcdefABCDEF'}. |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 \begin{datadesc}{letters} |
| 12352 | 40 The concatenation of the strings \constant{lowercase} and |
|
18776
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
41 \constant{uppercase} described below. The specific value is |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
42 locale-dependent, and will be updated when |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
43 \function{locale.setlocale()} is called. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 \begin{datadesc}{lowercase} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 A string containing all the characters that are considered lowercase |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 letters. On most systems this is the string |
|
2453
cdd3a721b40e
a few typographical changes (e.g. -- => ---) and lots of new stuff in the WWW chapter
Guido van Rossum <guido@python.org>
parents:
1789
diff
changeset
|
49 \code{'abcdefghijklmnopqrstuvwxyz'}. Do not change its definition --- |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
50 the effect on the routines \function{upper()} and |
|
18776
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
51 \function{swapcase()} is undefined. The specific value is |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
52 locale-dependent, and will be updated when |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
53 \function{locale.setlocale()} is called. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 \begin{datadesc}{octdigits} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 The string \code{'01234567'}. |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 |
|
14666
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
60 \begin{datadesc}{punctuation} |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
61 String of \ASCII{} characters which are considered punctuation |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
62 characters in the \samp{C} locale. |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
63 \end{datadesc} |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
64 |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
65 \begin{datadesc}{printable} |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
66 String of characters which are considered printable. This is a |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
67 combination of \constant{digits}, \constant{letters}, |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
68 \constant{punctuation}, and \constant{whitespace}. |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
69 \end{datadesc} |
|
1570854911ce
Document the "printable" and "punctuation" constants added to the string
Fred Drake <fdrake@acm.org>
parents:
14488
diff
changeset
|
70 |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 \begin{datadesc}{uppercase} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 A string containing all the characters that are considered uppercase |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 letters. On most systems this is the string |
|
2453
cdd3a721b40e
a few typographical changes (e.g. -- => ---) and lots of new stuff in the WWW chapter
Guido van Rossum <guido@python.org>
parents:
1789
diff
changeset
|
74 \code{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}. Do not change its definition --- |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
75 the effect on the routines \function{lower()} and |
|
18776
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
76 \function{swapcase()} is undefined. The specific value is |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
77 locale-dependent, and will be updated when |
|
22b2f4b436af
Added the constants ascii_letters, ascii_lowercase, and ascii_uppercase
Fred Drake <fdrake@acm.org>
parents:
17759
diff
changeset
|
78 \function{locale.setlocale()} is called. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 \begin{datadesc}{whitespace} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 A string containing all characters that are considered whitespace. |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 On most systems this includes the characters space, tab, linefeed, |
|
2453
cdd3a721b40e
a few typographical changes (e.g. -- => ---) and lots of new stuff in the WWW chapter
Guido van Rossum <guido@python.org>
parents:
1789
diff
changeset
|
84 return, formfeed, and vertical tab. Do not change its definition --- |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
85 the effect on the routines \function{strip()} and \function{split()} |
|
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
86 is undefined. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 \end{datadesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 |
|
14488
aba7eb9d8d61
Add a reference to the material on string methods.
Fred Drake <fdrake@acm.org>
parents:
12976
diff
changeset
|
89 |
|
aba7eb9d8d61
Add a reference to the material on string methods.
Fred Drake <fdrake@acm.org>
parents:
12976
diff
changeset
|
90 Many of the functions provided by this module are also defined as |
|
aba7eb9d8d61
Add a reference to the material on string methods.
Fred Drake <fdrake@acm.org>
parents:
12976
diff
changeset
|
91 methods of string and Unicode objects; see ``String Methods'' (section |
|
aba7eb9d8d61
Add a reference to the material on string methods.
Fred Drake <fdrake@acm.org>
parents:
12976
diff
changeset
|
92 \ref{string-methods}) for more information on those. |
|
2463
e764b78a704f
add warning about strop
Guido van Rossum <guido@python.org>
parents:
2453
diff
changeset
|
93 The functions defined in this module are: |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 \begin{funcdesc}{atof}{s} |
|
15009
9847b486d15f
Added deprecation notices to atof(), atoi(), and atol(), recommending
Fred Drake <fdrake@acm.org>
parents:
14710
diff
changeset
|
96 \deprecated{2.0}{Use the \function{float()} built-in function.} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
97 Convert a string to a floating point number. The string must have |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
98 the standard syntax for a floating point literal in Python, |
|
10229
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
99 optionally preceded by a sign (\samp{+} or \samp{-}). Note that |
|
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
100 this behaves identical to the built-in function |
|
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
101 \function{float()}\bifuncindex{float} when passed a string. |
|
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
102 |
|
20580
376ee174ecd0
Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents:
18776
diff
changeset
|
103 \note{When passing in a string, values for NaN\index{NaN} |
|
10229
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
104 and Infinity\index{Infinity} may be returned, depending on the |
|
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
105 underlying C library. The specific set of strings accepted which |
|
ce57eb30968a
Add notes to __builtin__.float() and string.atof() that the NaN and Inf
Fred Drake <fdrake@acm.org>
parents:
10222
diff
changeset
|
106 cause these values to be returned depends entirely on the C library |
|
20580
376ee174ecd0
Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents:
18776
diff
changeset
|
107 and is known to vary.} |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
110 \begin{funcdesc}{atoi}{s\optional{, base}} |
|
15009
9847b486d15f
Added deprecation notices to atof(), atoi(), and atol(), recommending
Fred Drake <fdrake@acm.org>
parents:
14710
diff
changeset
|
111 \deprecated{2.0}{Use the \function{int()} built-in function.} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
112 Convert string \var{s} to an integer in the given \var{base}. The |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
113 string must consist of one or more digits, optionally preceded by a |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
114 sign (\samp{+} or \samp{-}). The \var{base} defaults to 10. If it |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
115 is 0, a default base is chosen depending on the leading characters |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
116 of the string (after stripping the sign): \samp{0x} or \samp{0X} |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
117 means 16, \samp{0} means 8, anything else means 10. If \var{base} |
|
14710
ac6df0494c58
Fixed a number of small problems reported by Detlef Lannert
Fred Drake <fdrake@acm.org>
parents:
14666
diff
changeset
|
118 is 16, a leading \samp{0x} or \samp{0X} is always accepted, though |
|
ac6df0494c58
Fixed a number of small problems reported by Detlef Lannert
Fred Drake <fdrake@acm.org>
parents:
14666
diff
changeset
|
119 not required. This behaves identically to the built-in function |
|
ac6df0494c58
Fixed a number of small problems reported by Detlef Lannert
Fred Drake <fdrake@acm.org>
parents:
14666
diff
changeset
|
120 \function{int()} when passed a string. (Also note: for a more |
|
ac6df0494c58
Fixed a number of small problems reported by Detlef Lannert
Fred Drake <fdrake@acm.org>
parents:
14666
diff
changeset
|
121 flexible interpretation of numeric literals, use the built-in |
|
ac6df0494c58
Fixed a number of small problems reported by Detlef Lannert
Fred Drake <fdrake@acm.org>
parents:
14666
diff
changeset
|
122 function \function{eval()}\bifuncindex{eval}.) |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
125 \begin{funcdesc}{atol}{s\optional{, base}} |
|
15009
9847b486d15f
Added deprecation notices to atof(), atoi(), and atol(), recommending
Fred Drake <fdrake@acm.org>
parents:
14710
diff
changeset
|
126 \deprecated{2.0}{Use the \function{long()} built-in function.} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
127 Convert string \var{s} to a long integer in the given \var{base}. |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
128 The string must consist of one or more digits, optionally preceded |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
129 by a sign (\samp{+} or \samp{-}). The \var{base} argument has the |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
130 same meaning as for \function{atoi()}. A trailing \samp{l} or |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
131 \samp{L} is not allowed, except if the base is 0. Note that when |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
132 invoked without \var{base} or with \var{base} set to 10, this |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
133 behaves identical to the built-in function |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
134 \function{long()}\bifuncindex{long} when passed a string. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 |
|
3996
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
137 \begin{funcdesc}{capitalize}{word} |
|
23942
6e2a3c5700ac
Make the docs for string.capitalize() match those of str.capitalize()
Fred Drake <fdrake@acm.org>
parents:
23225
diff
changeset
|
138 Return a copy of \var{word} with only its first character capitalized. |
|
3996
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
139 \end{funcdesc} |
|
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
140 |
|
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
141 \begin{funcdesc}{capwords}{s} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
142 Split the argument into words using \function{split()}, capitalize |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
143 each word using \function{capitalize()}, and join the capitalized |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
144 words using \function{join()}. Note that this replaces runs of |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
145 whitespace characters by a single space, and removes leading and |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
146 trailing whitespace. |
|
3996
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
147 \end{funcdesc} |
|
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
148 |
|
15009
9847b486d15f
Added deprecation notices to atof(), atoi(), and atol(), recommending
Fred Drake <fdrake@acm.org>
parents:
14710
diff
changeset
|
149 \begin{funcdesc}{expandtabs}{s\optional{, tabsize}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
150 Expand tabs in a string, i.e.\ replace them by one or more spaces, |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
151 depending on the current column and the given tab size. The column |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
152 number is reset to zero after each newline occurring in the string. |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
153 This doesn't understand other non-printing characters or escape |
|
9952
e5d0df824bf3
Document the default for tabsize in expandtabs().
Guido van Rossum <guido@python.org>
parents:
9675
diff
changeset
|
154 sequences. The tab size defaults to 8. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
157 \begin{funcdesc}{find}{s, sub\optional{, start\optional{,end}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
158 Return the lowest index in \var{s} where the substring \var{sub} is |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
159 found such that \var{sub} is wholly contained in |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
160 \code{\var{s}[\var{start}:\var{end}]}. Return \code{-1} on failure. |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
161 Defaults for \var{start} and \var{end} and interpretation of |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
162 negative values is the same as for slices. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
165 \begin{funcdesc}{rfind}{s, sub\optional{, start\optional{, end}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
166 Like \function{find()} but find the highest index. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
169 \begin{funcdesc}{index}{s, sub\optional{, start\optional{, end}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
170 Like \function{find()} but raise \exception{ValueError} when the |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
171 substring is not found. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
174 \begin{funcdesc}{rindex}{s, sub\optional{, start\optional{, end}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
175 Like \function{rfind()} but raise \exception{ValueError} when the |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
176 substring is not found. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
179 \begin{funcdesc}{count}{s, sub\optional{, start\optional{, end}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
180 Return the number of (non-overlapping) occurrences of substring |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
181 \var{sub} in string \code{\var{s}[\var{start}:\var{end}]}. |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
182 Defaults for \var{start} and \var{end} and interpretation of |
| 12976 | 183 negative values are the same as for slices. |
|
1750
0b645726957e
libsocket.tex: send[to] returns nbytes.
Guido van Rossum <guido@python.org>
parents:
1471
diff
changeset
|
184 \end{funcdesc} |
|
0b645726957e
libsocket.tex: send[to] returns nbytes.
Guido van Rossum <guido@python.org>
parents:
1471
diff
changeset
|
185 |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 \begin{funcdesc}{lower}{s} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
187 Return a copy of \var{s}, but with upper case letters converted to |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
188 lower case. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 |
|
3858
8b71ea5dacc8
Added maketrans() and optional 3rd arg to translate() (chars to delete).
Guido van Rossum <guido@python.org>
parents:
3379
diff
changeset
|
191 \begin{funcdesc}{maketrans}{from, to} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
192 Return a translation table suitable for passing to |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
193 \function{translate()} or \function{regex.compile()}, that will map |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
194 each character in \var{from} into the character at the same position |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
195 in \var{to}; \var{from} and \var{to} must have the same length. |
|
8488
3604131f942d
Add warning about use of lowercase/uppercase with maketrans().
Guido van Rossum <guido@python.org>
parents:
7904
diff
changeset
|
196 |
|
20580
376ee174ecd0
Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents:
18776
diff
changeset
|
197 \warning{Don't use strings derived from \constant{lowercase} |
| 12352 | 198 and \constant{uppercase} as arguments; in some locales, these don't have |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
199 the same length. For case conversions, always use |
|
20580
376ee174ecd0
Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents:
18776
diff
changeset
|
200 \function{lower()} and \function{upper()}.} |
|
3858
8b71ea5dacc8
Added maketrans() and optional 3rd arg to translate() (chars to delete).
Guido van Rossum <guido@python.org>
parents:
3379
diff
changeset
|
201 \end{funcdesc} |
|
8b71ea5dacc8
Added maketrans() and optional 3rd arg to translate() (chars to delete).
Guido van Rossum <guido@python.org>
parents:
3379
diff
changeset
|
202 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
203 \begin{funcdesc}{split}{s\optional{, sep\optional{, maxsplit}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
204 Return a list of the words of the string \var{s}. If the optional |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
205 second argument \var{sep} is absent or \code{None}, the words are |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
206 separated by arbitrary strings of whitespace characters (space, tab, |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
207 newline, return, formfeed). If the second argument \var{sep} is |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
208 present and not \code{None}, it specifies a string to be used as the |
|
10882
06def8042d8e
Typo reported by Gerry Wiener <wiener@rap.ucar.edu>:
Fred Drake <fdrake@acm.org>
parents:
10703
diff
changeset
|
209 word separator. The returned list will then have one more item |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
210 than the number of non-overlapping occurrences of the separator in |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
211 the string. The optional third argument \var{maxsplit} defaults to |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
212 0. If it is nonzero, at most \var{maxsplit} number of splits occur, |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
213 and the remainder of the string is returned as the final element of |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
214 the list (thus, the list will have at most \code{\var{maxsplit}+1} |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
215 elements). |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
216 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
217 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
218 \begin{funcdesc}{splitfields}{s\optional{, sep\optional{, maxsplit}}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
219 This function behaves identically to \function{split()}. (In the |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
220 past, \function{split()} was only used with one argument, while |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
221 \function{splitfields()} was only used with two arguments.) |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
224 \begin{funcdesc}{join}{words\optional{, sep}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
225 Concatenate a list or tuple of words with intervening occurrences of |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
226 \var{sep}. The default value for \var{sep} is a single space |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
227 character. It is always true that |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
228 \samp{string.join(string.split(\var{s}, \var{sep}), \var{sep})} |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
229 equals \var{s}. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
232 \begin{funcdesc}{joinfields}{words\optional{, sep}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
233 This function behaves identical to \function{join()}. (In the past, |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
234 \function{join()} was only used with one argument, while |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
235 \function{joinfields()} was only used with two arguments.) |
|
3996
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
236 \end{funcdesc} |
|
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
237 |
|
23225
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
238 \begin{funcdesc}{lstrip}{s\optional{, chars}} |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
239 Return a copy of the string with leading characters removed. If |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
240 \var{chars} is omitted or \code{None}, whitespace characters are |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
241 removed. If given and not \code{None}, \var{chars} must be a string; |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
242 the characters in the string will be stripped from the beginning of |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
243 the string this method is called on. |
|
3996
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
244 \end{funcdesc} |
|
0ec2ce97b8e3
Added capitalize, capwords, lstrip, rstrip, and optional 3rd argument
Guido van Rossum <guido@python.org>
parents:
3858
diff
changeset
|
245 |
|
23225
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
246 \begin{funcdesc}{rstrip}{s\optional{, chars}} |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
247 Return a copy of the string with trailing characters removed. If |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
248 \var{chars} is omitted or \code{None}, whitespace characters are |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
249 removed. If given and not \code{None}, \var{chars} must be a string; |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
250 the characters in the string will be stripped from the end of the |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
251 string this method is called on. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
253 |
|
23225
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
254 \begin{funcdesc}{strip}{s\optional{, chars}} |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
255 Return a copy of the string with leading and trailing characters |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
256 removed. If \var{chars} is omitted or \code{None}, whitespace |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
257 characters are removed. If given and not \code{None}, \var{chars} |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
258 must be a string; the characters in the string will be stripped from |
|
e639e34ef901
Apply patch diff.txt from SF feature request
Walter Dörwald <walter@livinglogic.de>
parents:
20580
diff
changeset
|
259 the both ends of the string this method is called on. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
260 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
261 |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 \begin{funcdesc}{swapcase}{s} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
263 Return a copy of \var{s}, but with lower case letters |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
264 converted to upper case and vice versa. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
265 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
266 |
|
3858
8b71ea5dacc8
Added maketrans() and optional 3rd arg to translate() (chars to delete).
Guido van Rossum <guido@python.org>
parents:
3379
diff
changeset
|
267 \begin{funcdesc}{translate}{s, table\optional{, deletechars}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
268 Delete all characters from \var{s} that are in \var{deletechars} (if |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
269 present), and then translate the characters using \var{table}, which |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
270 must be a 256-character string giving the translation for each |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
271 character value, indexed by its ordinal. |
|
3084
91c1bb75e945
added string.translate(s, table)
Guido van Rossum <guido@python.org>
parents:
2647
diff
changeset
|
272 \end{funcdesc} |
|
91c1bb75e945
added string.translate(s, table)
Guido van Rossum <guido@python.org>
parents:
2647
diff
changeset
|
273 |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 \begin{funcdesc}{upper}{s} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
275 Return a copy of \var{s}, but with lower case letters converted to |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
276 upper case. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
279 \begin{funcdesc}{ljust}{s, width} |
|
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
280 \funcline{rjust}{s, width} |
|
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
281 \funcline{center}{s, width} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
282 These functions respectively left-justify, right-justify and center |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
283 a string in a field of given width. They return a string that is at |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
284 least \var{width} characters wide, created by padding the string |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
285 \var{s} with spaces until the given width on the right, left or both |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
286 sides. The string is never truncated. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
287 \end{funcdesc} |
|
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
288 |
|
7712
0cbc9df882b6
Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents:
7277
diff
changeset
|
289 \begin{funcdesc}{zfill}{s, width} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
290 Pad a numeric string on the left with zero digits until the given |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
291 width is reached. Strings starting with a sign are handled |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
292 correctly. |
|
1471
2ec96140a36b
Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
293 \end{funcdesc} |
|
2463
e764b78a704f
add warning about strop
Guido van Rossum <guido@python.org>
parents:
2453
diff
changeset
|
294 |
|
5245
c5fd327057c6
Add cross-refs for int() to atoi() etc.
Guido van Rossum <guido@python.org>
parents:
5212
diff
changeset
|
295 \begin{funcdesc}{replace}{str, old, new\optional{, maxsplit}} |
|
9675
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
296 Return a copy of string \var{str} with all occurrences of substring |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
297 \var{old} replaced by \var{new}. If the optional argument |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
298 \var{maxsplit} is given, the first \var{maxsplit} occurrences are |
|
b78049fefceb
Clarify descriptions of some operations; it's not always clear that
Fred Drake <fdrake@acm.org>
parents:
8918
diff
changeset
|
299 replaced. |
|
5212
1f38d5fb3d23
Added docs for replace() and replace1().
Guido van Rossum <guido@python.org>
parents:
5188
diff
changeset
|
300 \end{funcdesc} |
