@@ -1994,10 +1994,16 @@ expression support in the :mod:`re` module).
19941994 ``{} ``. Each replacement field contains either the numeric index of a
19951995 positional argument, or the name of a keyword argument. Returns a copy of
19961996 the string where each replacement field is replaced with the string value of
1997- the corresponding argument.
1997+ the corresponding argument. For example:
1998+
1999+ ..doctest ::
19982000
19992001 >>>" The sum of 1 + 2 is{0} " .format(1 + 2 )
20002002'The sum of 1 + 2 is 3'
2003+ >>>" The sum of{a} +{b} is{answer} " .format(answer = 1 + 2 ,a = 1 ,b = 2 )
2004+ 'The sum of 1 + 2 is 3'
2005+ >>>" {1} expects the{0} Inquisition!" .format(" Spanish" ," Nobody" )
2006+ 'Nobody expects the Spanish Inquisition!'
20012007
20022008 See:ref: `formatstrings ` for a description of the various formatting options
20032009 that can be specified in format strings.
@@ -2057,13 +2063,32 @@ expression support in the :mod:`re` module).
20572063 from the `Alphabetic property defined in the section 4.10 'Letters, Alphabetic, and
20582064Ideographic' of the Unicode Standard
20592065<https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-4/#G91002> `_.
2066+ For example:
2067+
2068+ ..doctest ::
2069+
2070+ >>>' Letters and spaces' .isalpha()
2071+ False
2072+ >>>' LettersOnly' .isalpha()
2073+ True
2074+ >>>' µ' .isalpha()# non-ASCII characters can be considered alphabetical too
2075+ True
2076+
2077+ See:ref: `unicode-properties `.
20602078
20612079
20622080..method ::str.isascii()
20632081
20642082 Return ``True `` if the string is empty or all characters in the string are ASCII,
20652083 ``False `` otherwise.
2066- ASCII characters have code points in the range U+0000-U+007F.
2084+ ASCII characters have code points in the range U+0000-U+007F. For example:
2085+
2086+ ..doctest ::
2087+
2088+ >>>' ASCII characters' .isascii()
2089+ True
2090+ >>>' µ' .isascii()
2091+ False
20672092
20682093 ..versionadded ::3.7
20692094
@@ -2073,9 +2098,18 @@ expression support in the :mod:`re` module).
20732098 Return ``True `` if all characters in the string are decimal
20742099 characters and there is at least one character, ``False ``
20752100 otherwise. Decimal characters are those that can be used to form
2076- numbers in base 10,e.g. U+0660, ARABIC-INDIC DIGIT
2101+ numbers in base 10,such as U+0660, ARABIC-INDIC DIGIT
20772102 ZERO. Formally a decimal character is a character in the Unicode
2078- General Category "Nd".
2103+ General Category "Nd". For example:
2104+
2105+ ..doctest ::
2106+
2107+ >>>' 0123456789' .isdecimal()
2108+ True
2109+ >>>' ٠١٢٣٤٥٦٧٨٩' .isdecimal()# Arabic-Indic digits zero to nine
2110+ True
2111+ >>>' alphabetic' .isdecimal()
2112+ False
20792113
20802114
20812115..method ::str.isdigit()
@@ -2194,7 +2228,16 @@ expression support in the :mod:`re` module).
21942228 Return a string which is the concatenation of the strings in *iterable *.
21952229 A:exc: `TypeError ` will be raised if there are any non-string values in
21962230 *iterable *, including:class: `bytes ` objects. The separator between
2197- elements is the string providing this method.
2231+ elements is the string providing this method. For example:
2232+
2233+ ..doctest ::
2234+
2235+ >>>' ,' .join([' spam' ,' spam' ,' spam' ])
2236+ 'spam, spam, spam'
2237+ >>>' -' .join(' Python' )
2238+ 'P-y-t-h-o-n'
2239+
2240+ See also:meth: `split `.
21982241
21992242
22002243..method ::str.ljust(width, fillchar=' ', /)
@@ -2408,6 +2451,8 @@ expression support in the :mod:`re` module).
24082451 >>> " foo ".split(maxsplit=0)
24092452 ['foo ']
24102453
2454+ See also:meth: `join `.
2455+
24112456
24122457..index ::
24132458 single: universal newlines; str.splitlines method