Home | Trees | Index | Help |
---|
|
A collection of string operations (most are no longer used).
Warning: most of the code you see here isn't normally used nowadays. Beginning with Python 1.6, many of these functions are implemented as methods on the standard string object. They used to be implemented by a built-in module called strop, but strop is now obsolete itself.
Public module variables:
whitespace -- a string containing all characters considered whitespace lowercase -- a string containing all characters considered lowercase letters uppercase -- a string containing all characters considered uppercase letters letters -- a string containing all characters considered letters digits -- a string containing all characters considered decimal digits hexdigits -- a string containing all characters considered hexadecimal digits octdigits -- a string containing all characters considered octal digits punctuation -- a string containing all characters considered punctuation printable -- a string containing all characters considered printable
|
|||
Template | A string class for supporting $-substitutions. | ||
_TemplateMetaclass | |||
_multimap | Helper class for combining multiple mappings. |
|
|||
atof(s)
Return the floating point number represented by the string s. |
|||
atoi(s,
base=...)
Return the integer represented by the string s in the given base, which defaults to 10. |
|||
atol(s,
base=...)
Return the long integer represented by the string s in the given base, which defaults to 10. |
|||
capitalize(s)
Return a copy of the string s with only its first character capitalized. |
|||
capwords(s,
sep={})
capwords(s, [sep]) -> string |
|||
center(s,
width,
fillchar=...)
Return a center version of s, in a field of the specified width. |
|||
count(s,
sub,
start=...,
end=...)
Return the number of occurrences of substring sub in string s[start:end]. |
|||
expandtabs(s,
tabsize=...)
Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). |
|||
find(s,
sub,
start=... ,
end=...)
Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. |
|||
index(s,
sub,
start=... ,
end=...)
Like find but raises ValueError when the substring is not found. |
|||
join(list,
sep=...)
Return a string composed of the words in list, with intervening occurrences of sep. |
|||
joinfields(list,
sep=...)
Return a string composed of the words in list, with intervening occurrences of sep. |
|||
ljust(s,
width,
fillchar=...)
Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. |
|||
lower(s)
Return a copy of the string s converted to lowercase. |
|||
lstrip(s,
chars=...)
Return a copy of the string s with leading whitespace removed. |
|||
replace(s,
old,
new,
maxsplit=-1)
replace (str, old, new[, maxsplit]) -> string |
|||
rfind(s,
sub,
start=... ,
end=...)
Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. |
|||
rindex(s,
sub,
start=... ,
end=...)
Like rfind but raises ValueError when the substring is not found. |
|||
rjust(s,
width,
fillchar=...)
Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. |
|||
rsplit(s,
sep=... ,
maxsplit=...)
Return a list of the words in the string s, using sep as the delimiter string, starting at the end of the string and working to the front. |
|||
rstrip(s,
chars=...)
Return a copy of the string s with trailing whitespace removed. |
|||
split(s,
sep=... ,
maxsplit=...)
Return a list of the words in the string s, using sep as the delimiter string. |
|||
splitfields(s,
sep=... ,
maxsplit=...)
Return a list of the words in the string s, using sep as the delimiter string. |
|||
strip(s,
chars=...)
Return a copy of the string s with leading and trailing whitespace removed. |
|||
swapcase(s)
Return a copy of the string s with upper case characters converted to lowercase and vice versa. |
|||
translate(s,
table,
deletions=...)
Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. |
|||
upper(s)
Return a copy of the string s converted to uppercase. |
|||
zfill(x,
width)
Pad a numeric string x with zeros on the left, to fill a field of the specified width. |
|
|||
_idmap | |||
_idmapL | |||
ascii_letters | |||
ascii_lowercase | |||
ascii_uppercase | |||
digits | |||
hexdigits | |||
letters | |||
lowercase | |||
octdigits | |||
printable | |||
punctuation | |||
uppercase | |||
whitespace |
|
|
|
|
|
capwords(s, [sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. Note that this replaces runs of whitespace characters by a single space. |
|
|
|
Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
|
|
Return a string composed of the words in list, with intervening occurrences of sep. The default separator is a single space. (joinfields and join are synonymous)
|
Return a string composed of the words in list, with intervening occurrences of sep. The default separator is a single space. (joinfields and join are synonymous)
|
|
|
|
replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. |
Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
|
|
|
|
|
Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified or is None, any whitespace string is a separator. (split and splitfields are synonymous)
|
Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified or is None, any whitespace string is a separator. (split and splitfields are synonymous)
|
|
|
|
|
|
|
_idmap
|
_idmapL
|
ascii_letters
|
ascii_lowercase
|
ascii_uppercase
|
digits
|
hexdigits
|
letters
|
lowercase
|
octdigits
|
printable
|
punctuation
|
uppercase
|
whitespace
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 3.0alpha2 on Fri Sep 28 00:57:30 2007 | http://epydoc.sf.net |