📄 types.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>2.1 Built-in Types </title>
<META NAME="description" CONTENT="2.1 Built-in Types ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="module-exceptions.html" tppabs="http://www.python.org/doc/current/lib/module-exceptions.html">
<LINK REL="previous" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">
<LINK REL="up" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">
<LINK REL="next" href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">2. Built-in Types, Exceptions</A>
<b class="navlabel">Up:</b> <a class="sectref" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">2. Built-in Types, Exceptions</A>
<b class="navlabel">Next:</b> <a class="sectref" href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html">2.1.1 Truth Value Testing</A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H1>
<BR>
2.1 Built-in Types
</H1>
<P>
The following sections describe the standard types that are built into
the interpreter. These are the numeric types, sequence types, and
several others, including types themselves. There is no explicit
Boolean type; use integers instead.
<P>
Some operations are supported by several object types; in particular,
all objects can be compared, tested for truth value, and converted to
a string (with the <code>` ...`</code> notation). The latter
conversion is implicitly used when an object is written by the
<tt class="keyword">print</tt> statement.
<P>
<p><hr>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A NAME="tex2html954"
href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html">2.1.1 Truth Value Testing </A>
<LI><A NAME="tex2html955"
href="boolean.html" tppabs="http://www.python.org/doc/current/lib/boolean.html">2.1.2 Boolean Operations </A>
<LI><A NAME="tex2html956"
href="comparisons.html" tppabs="http://www.python.org/doc/current/lib/comparisons.html">2.1.3 Comparisons </A>
<LI><A NAME="tex2html957"
href="typesnumeric.html" tppabs="http://www.python.org/doc/current/lib/typesnumeric.html">2.1.4 Numeric Types </A>
<UL>
<LI><A NAME="tex2html958"
href="bitstring-ops.html" tppabs="http://www.python.org/doc/current/lib/bitstring-ops.html">2.1.4.1 Bit-string Operations on Integer Types </A>
</UL>
<LI><A NAME="tex2html959"
href="typesseq.html" tppabs="http://www.python.org/doc/current/lib/typesseq.html">2.1.5 Sequence Types </A>
<UL>
<LI><A NAME="tex2html960"
href="string-methods.html" tppabs="http://www.python.org/doc/current/lib/string-methods.html">2.1.5.1 String Methods </A>
<LI><A NAME="tex2html961"
href="typesseq-strings.html" tppabs="http://www.python.org/doc/current/lib/typesseq-strings.html">2.1.5.2 String Formatting Operations </A>
<LI><A NAME="tex2html962"
href="typesseq-xrange.html" tppabs="http://www.python.org/doc/current/lib/typesseq-xrange.html">2.1.5.3 XRange Type </A>
<LI><A NAME="tex2html963"
href="typesseq-mutable.html" tppabs="http://www.python.org/doc/current/lib/typesseq-mutable.html">2.1.5.4 Mutable Sequence Types </A>
</UL>
<LI><A NAME="tex2html964"
href="typesmapping.html" tppabs="http://www.python.org/doc/current/lib/typesmapping.html">2.1.6 Mapping Types </A>
<LI><A NAME="tex2html965"
href="typesother.html" tppabs="http://www.python.org/doc/current/lib/typesother.html">2.1.7 Other Built-in Types </A>
<UL>
<LI><A NAME="tex2html966"
href="typesmodules.html" tppabs="http://www.python.org/doc/current/lib/typesmodules.html">2.1.7.1 Modules </A>
<LI><A NAME="tex2html967"
href="typesobjects.html" tppabs="http://www.python.org/doc/current/lib/typesobjects.html">2.1.7.2 Classes and Class Instances </A>
<LI><A NAME="tex2html968"
href="typesfunctions.html" tppabs="http://www.python.org/doc/current/lib/typesfunctions.html">2.1.7.3 Functions </A>
<LI><A NAME="tex2html969"
href="typesmethods.html" tppabs="http://www.python.org/doc/current/lib/typesmethods.html">2.1.7.4 Methods </A>
<LI><A NAME="tex2html970"
href="bltin-code-objects.html" tppabs="http://www.python.org/doc/current/lib/bltin-code-objects.html">2.1.7.5 Code Objects </A>
<LI><A NAME="tex2html971"
href="bltin-type-objects.html" tppabs="http://www.python.org/doc/current/lib/bltin-type-objects.html">2.1.7.6 Type Objects </A>
<LI><A NAME="tex2html972"
href="bltin-null-object.html" tppabs="http://www.python.org/doc/current/lib/bltin-null-object.html">2.1.7.7 The Null Object </A>
<LI><A NAME="tex2html973"
href="bltin-ellipsis-object.html" tppabs="http://www.python.org/doc/current/lib/bltin-ellipsis-object.html">2.1.7.8 The Ellipsis Object </A>
<LI><A NAME="tex2html974"
href="bltin-file-objects.html" tppabs="http://www.python.org/doc/current/lib/bltin-file-objects.html">2.1.7.9 File Objects
</A>
<LI><A NAME="tex2html975"
href="typesinternal.html" tppabs="http://www.python.org/doc/current/lib/typesinternal.html">2.1.7.10 Internal Objects </A>
</UL>
<LI><A NAME="tex2html976"
href="specialattrs.html" tppabs="http://www.python.org/doc/current/lib/specialattrs.html">2.1.8 Special Attributes </A>
</UL>
<!--End of Table of Child-Links-->
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">2. Built-in Types, Exceptions</A>
<b class="navlabel">Up:</b> <a class="sectref" href="builtin.html" tppabs="http://www.python.org/doc/current/lib/builtin.html">2. Built-in Types, Exceptions</A>
<b class="navlabel">Next:</b> <a class="sectref" href="truth.html" tppabs="http://www.python.org/doc/current/lib/truth.html">2.1.1 Truth Value Testing</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -