Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / node111.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="node110.html" />
<link rel="parent" href="module-string.html" />
<link rel="next" href="module-re.html" />
<meta name='aesop' content='information' />
<title>4.1.4 Deprecated string functions</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="4.1.3 String functions"
href="node110.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="4.1 string "
href="module-string.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="4.2 re "
href="module-re.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="node110.html">4.1.3 String functions</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-string.html">4.1 string </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-re.html">4.2 re </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION006140000000000000000">
4.1.4 Deprecated string functions</A>
</H2>
<P>
The following list of functions are also defined as methods of string and
Unicode objects; see ``String Methods'' (section
<A href="string-methods.html#string-methods">2.3.6</A>) for more information on those. You should consider
these functions as deprecated, although they will not be removed until Python
3.0. The functions defined in this module are:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-836' xml:id='l2h-836' class="function">atof</tt></b>(</nobr></td>
<td><var>s</var>)</td></tr></table></dt>
<dd>
<div class="versionnote"><b>Deprecated since release 2.0.</b>
Use the <tt class="function">float()</tt> built-in function.</div><p></p>
Convert a string to a floating point number. The string must have
the standard syntax for a floating point literal in Python,
optionally preceded by a sign ("<tt class="samp">+</tt>" or "<tt class="samp">-</tt>"). Note that
this behaves identical to the built-in function
<tt class="function">float()</tt><a id='l2h-837' xml:id='l2h-837'></a> when passed a string.
<P>
<span class="note"><b class="label">Note:</b>
When passing in a string, values for NaN<a id='l2h-838' xml:id='l2h-838'></a>
and Infinity<a id='l2h-839' xml:id='l2h-839'></a> may be returned, depending on the
underlying C library. The specific set of strings accepted which
cause these values to be returned depends entirely on the C library
and is known to vary.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-840' xml:id='l2h-840' class="function">atoi</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, base</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
<div class="versionnote"><b>Deprecated since release 2.0.</b>
Use the <tt class="function">int()</tt> built-in function.</div><p></p>
Convert string <var>s</var> to an integer in the given <var>base</var>. The
string must consist of one or more digits, optionally preceded by a
sign ("<tt class="samp">+</tt>" or "<tt class="samp">-</tt>"). The <var>base</var> defaults to 10. If it
is 0, a default base is chosen depending on the leading characters
of the string (after stripping the sign): "<tt class="samp">0x</tt>" or "<tt class="samp">0X</tt>" means 16, "<tt class="samp">0</tt>" means 8, anything else means 10. If <var>base</var>
is 16, a leading "<tt class="samp">0x</tt>" or "<tt class="samp">0X</tt>" is always accepted, though
not required. This behaves identically to the built-in function
<tt class="function">int()</tt> when passed a string. (Also note: for a more
flexible interpretation of numeric literals, use the built-in
function <tt class="function">eval()</tt><a id='l2h-841' xml:id='l2h-841'></a>.)
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-842' xml:id='l2h-842' class="function">atol</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, base</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
<div class="versionnote"><b>Deprecated since release 2.0.</b>
Use the <tt class="function">long()</tt> built-in function.</div><p></p>
Convert string <var>s</var> to a long integer in the given <var>base</var>.
The string must consist of one or more digits, optionally preceded
by a sign ("<tt class="samp">+</tt>" or "<tt class="samp">-</tt>"). The <var>base</var> argument has the
same meaning as for <tt class="function">atoi()</tt>. A trailing "<tt class="samp">l</tt>" or
"<tt class="samp">L</tt>" is not allowed, except if the base is 0. Note that when
invoked without <var>base</var> or with <var>base</var> set to 10, this
behaves identical to the built-in function
<tt class="function">long()</tt><a id='l2h-843' xml:id='l2h-843'></a> when passed a string.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-844' xml:id='l2h-844' class="function">capitalize</tt></b>(</nobr></td>
<td><var>word</var>)</td></tr></table></dt>
<dd>
Return a copy of <var>word</var> with only its first character capitalized.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-845' xml:id='l2h-845' class="function">expandtabs</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, tabsize</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Expand tabs in a string replacing them by one or more spaces,
depending on the current column and the given tab size. The column
number is reset to zero after each newline occurring in the string.
This doesn't understand other non-printing characters or escape
sequences. The tab size defaults to 8.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-846' xml:id='l2h-846' class="function">find</tt></b>(</nobr></td>
<td><var>s, sub</var><big>[</big><var>, start</var><big>[</big><var>,end</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return the lowest index in <var>s</var> where the substring <var>sub</var> is
found such that <var>sub</var> is wholly contained in
<code><var>s</var>[<var>start</var>:<var>end</var>]</code>. Return <code>-1</code> on failure.
Defaults for <var>start</var> and <var>end</var> and interpretation of
negative values is the same as for slices.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-847' xml:id='l2h-847' class="function">rfind</tt></b>(</nobr></td>
<td><var>s, sub</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Like <tt class="function">find()</tt> but find the highest index.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-848' xml:id='l2h-848' class="function">index</tt></b>(</nobr></td>
<td><var>s, sub</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Like <tt class="function">find()</tt> but raise <tt class="exception">ValueError</tt> when the
substring is not found.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-849' xml:id='l2h-849' class="function">rindex</tt></b>(</nobr></td>
<td><var>s, sub</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Like <tt class="function">rfind()</tt> but raise <tt class="exception">ValueError</tt> when the
substring is not found.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-850' xml:id='l2h-850' class="function">count</tt></b>(</nobr></td>
<td><var>s, sub</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return the number of (non-overlapping) occurrences of substring
<var>sub</var> in string <code><var>s</var>[<var>start</var>:<var>end</var>]</code>.
Defaults for <var>start</var> and <var>end</var> and interpretation of
negative values are the same as for slices.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-851' xml:id='l2h-851' class="function">lower</tt></b>(</nobr></td>
<td><var>s</var>)</td></tr></table></dt>
<dd>
Return a copy of <var>s</var>, but with upper case letters converted to
lower case.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-852' xml:id='l2h-852' class="function">split</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, sep</var><big>[</big><var>, maxsplit</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a list of the words of the string <var>s</var>. If the optional
second argument <var>sep</var> is absent or <code>None</code>, the words are
separated by arbitrary strings of whitespace characters (space, tab,
newline, return, formfeed). If the second argument <var>sep</var> is
present and not <code>None</code>, it specifies a string to be used as the
word separator. The returned list will then have one more item
than the number of non-overlapping occurrences of the separator in
the string. The optional third argument <var>maxsplit</var> defaults to
0. If it is nonzero, at most <var>maxsplit</var> number of splits occur,
and the remainder of the string is returned as the final element of
the list (thus, the list will have at most <code><var>maxsplit</var>+1</code>
elements).
<P>
The behavior of split on an empty string depends on the value of <var>sep</var>.
If <var>sep</var> is not specified, or specified as <code>None</code>, the result will
be an empty list. If <var>sep</var> is specified as any string, the result will
be a list containing one element which is an empty string.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-853' xml:id='l2h-853' class="function">rsplit</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, sep</var><big>[</big><var>, maxsplit</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a list of the words of the string <var>s</var>, scanning <var>s</var>
from the end. To all intents and purposes, the resulting list of
words is the same as returned by <tt class="function">split()</tt>, except when the
optional third argument <var>maxsplit</var> is explicitly specified and
nonzero. When <var>maxsplit</var> is nonzero, at most <var>maxsplit</var>
number of splits - the <em>rightmost</em> ones - occur, and the remainder
of the string is returned as the first element of the list (thus, the
list will have at most <code><var>maxsplit</var>+1</code> elements).
<span class="versionnote">New in version 2.4.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-854' xml:id='l2h-854' class="function">splitfields</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, sep</var><big>[</big><var>, maxsplit</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
This function behaves identically to <tt class="function">split()</tt>. (In the
past, <tt class="function">split()</tt> was only used with one argument, while
<tt class="function">splitfields()</tt> was only used with two arguments.)
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-855' xml:id='l2h-855' class="function">join</tt></b>(</nobr></td>
<td><var>words</var><big>[</big><var>, sep</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Concatenate a list or tuple of words with intervening occurrences of
<var>sep</var>. The default value for <var>sep</var> is a single space
character. It is always true that
"<tt class="samp">string.join(string.split(<var>s</var>, <var>sep</var>), <var>sep</var>)</tt>" equals <var>s</var>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-856' xml:id='l2h-856' class="function">joinfields</tt></b>(</nobr></td>
<td><var>words</var><big>[</big><var>, sep</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
This function behaves identically to <tt class="function">join()</tt>. (In the past,
<tt class="function">join()</tt> was only used with one argument, while
<tt class="function">joinfields()</tt> was only used with two arguments.)
Note that there is no <tt class="method">joinfields()</tt> method on string
objects; use the <tt class="method">join()</tt> method instead.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-857' xml:id='l2h-857' class="function">lstrip</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, chars</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a copy of the string with leading characters removed. If
<var>chars</var> is omitted or <code>None</code>, whitespace characters are
removed. If given and not <code>None</code>, <var>chars</var> must be a string;
the characters in the string will be stripped from the beginning of
the string this method is called on.
<span class="versionnote">Changed in version 2.2.3:
The <var>chars</var> parameter was added. The <var>chars</var>
parameter cannot be passed in earlier 2.2 versions.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-858' xml:id='l2h-858' class="function">rstrip</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, chars</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a copy of the string with trailing characters removed. If
<var>chars</var> is omitted or <code>None</code>, whitespace characters are
removed. If given and not <code>None</code>, <var>chars</var> must be a string;
the characters in the string will be stripped from the end of the
string this method is called on.
<span class="versionnote">Changed in version 2.2.3:
The <var>chars</var> parameter was added. The <var>chars</var>
parameter cannot be passed in earlier 2.2 versions.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-859' xml:id='l2h-859' class="function">strip</tt></b>(</nobr></td>
<td><var>s</var><big>[</big><var>, chars</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a copy of the string with leading and trailing characters
removed. If <var>chars</var> is omitted or <code>None</code>, whitespace
characters are removed. If given and not <code>None</code>, <var>chars</var>
must be a string; the characters in the string will be stripped from
the both ends of the string this method is called on.
<span class="versionnote">Changed in version 2.2.3:
The <var>chars</var> parameter was added. The <var>chars</var>
parameter cannot be passed in earlier 2.2 versions.</span>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-860' xml:id='l2h-860' class="function">swapcase</tt></b>(</nobr></td>
<td><var>s</var>)</td></tr></table></dt>
<dd>
Return a copy of <var>s</var>, but with lower case letters
converted to upper case and vice versa.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-861' xml:id='l2h-861' class="function">translate</tt></b>(</nobr></td>
<td><var>s, table</var><big>[</big><var>, deletechars</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Delete all characters from <var>s</var> that are in <var>deletechars</var> (if
present), and then translate the characters using <var>table</var>, which
must be a 256-character string giving the translation for each
character value, indexed by its ordinal.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-862' xml:id='l2h-862' class="function">upper</tt></b>(</nobr></td>
<td><var>s</var>)</td></tr></table></dt>
<dd>
Return a copy of <var>s</var>, but with lower case letters converted to
upper case.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-863' xml:id='l2h-863' class="function">ljust</tt></b>(</nobr></td>
<td><var>s, width</var>)</td></tr></table></dt>
<dd>
<dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt class="function">rjust</tt></b>(</nobr></td>
<td><var>s, width</var>)</td></tr></table></dt>
<dd><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt class="function">center</tt></b>(</nobr></td>
<td><var>s, width</var>)</td></tr></table></dt>
<dd> These functions respectively left-justify, right-justify and center
a string in a field of given width. They return a string that is at
least <var>width</var> characters wide, created by padding the string
<var>s</var> with spaces until the given width on the right, left or both
sides. The string is never truncated.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-866' xml:id='l2h-866' class="function">zfill</tt></b>(</nobr></td>
<td><var>s, width</var>)</td></tr></table></dt>
<dd>
Pad a numeric string on the left with zero digits until the given
width is reached. Strings starting with a sign are handled
correctly.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-867' xml:id='l2h-867' class="function">replace</tt></b>(</nobr></td>
<td><var>str, old, new</var><big>[</big><var>, maxreplace</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a copy of string <var>str</var> with all occurrences of substring
<var>old</var> replaced by <var>new</var>. If the optional argument
<var>maxreplace</var> is given, the first <var>maxreplace</var> occurrences are
replaced.
</dl>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="4.1.3 String functions"
href="node110.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="4.1 string "
href="module-string.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="4.2 re "
href="module-re.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="node110.html">4.1.3 String functions</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-string.html">4.1 string </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-re.html">4.2 re </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>