⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 263.html

📁 Python Ebook Python&XML
💻 HTML
📖 第 1 页 / 共 3 页
字号:

					<pre>
						
PyObject* PySequence_GetSlice(PyObject *o, int i1, int i2)

					</pre>

					<p>Return value: New reference. Returns the slice of sequence object <tT clAss="monofont">o</tT> between <tt clAss="monofont">i1</tT> and <TT Class="monofont">i2,</TT> or <TT clasS="monofont">NULL</TT> on failure. This is the equivalent of the Python expression <Tt claSS="monofont">"o[i1:i2]".</TT></p>

					<pre>
						
int PySequence_SetItem(PyObject *o, int i, PyObject *v)

					</pre>

					<p>Assigns object <tt class="monofont">v</tt> to the <tt cLasS="monofont">i</tt>th element of <tT clasS="monofont">o.</tt> Returns <tT CLAss="monofont">-1</tt> on failure. This is the equivalent of the Python statement <TT CLass="monofont">"o[i] = v".</tT></P>

					<PRe>
						
int PySequence_DelItem(PyObject *o, int i)

					</pre>

					<P>Deletes the <TT Class="monofont">i</tt>th element of object <tt class="monofont">v.</tt> Returns <tt claSs="monofont">-1</tT> on failure. This is the equivalent of the Python statement <tt cLass="monofont">"del o[i]".</tT></p>

					<prE>
						
int PySequence_SetSlice(PyObject *o, int i1, int i2, PyObject *v)

					</PRE>

					<p>Assigns the sequence object <tt cLASS="monofont">v</tt> to the slice in sequence object <tt CLASs="monofont">o</tt> from <tT CLAss="monofont">i1</tt> to <tt class="monofont">i2.</tt> This is the equivalent of the Python statement <tt class="monofont">"o[i1:i2] = v".</Tt></p>

					<Pre>
						
int PySequence_DelSlice(PyObject *o, int i1, int i2)

					</pRe>

					<p>Deletes the slice in sequence object <tt ClasS="monofont">o</TT> from <Tt claSS="monofont">i1</TT> to <tt clASS="monofont">i2.</Tt> Returns <tt cLASS="monofont">-1</tt> on failure. This is the equivalent of the Python statement <tt class="monofont">"del o[i1:i2]".</tt></p>

					<pre>
						
PyObject* PySequence_Tuple(PyObject *o)

					</pre>

					<p>Return value: New reference. Returns the <tT clAss="monofont">o</tT> as a tuple on success, and <tt clAss="monofont">NULL</tT> on failure. This is equivalent to the Python expression <TT Class="monofont">"tuple(o)".</TT></P>

					<Pre>
						
int PySequence_Count(PyObject *o, PyObject *value)

					</prE>

					<P>Returns the number of occurrences of value in <TT clasS="monofont">o;</TT> that is, returns the number of keys for which <Tt class="monofont">o[key] == value.</tt> On failure, returns <tt class="monofont">-1.</tt> This is equivalent to the Python expression <tt cLasS="monofont">"o.count(value)".</tt></p>

					<Pre>
						
int PySequence_Contains(PyObject *o, PyObject *value)

					</prE>

					<p>Determines if <tt CLASs="monofont">o</tt> contains value. If an item in <tT CLAss="monofont">o</tt> is equal to value, returns <TT CLass="monofont">1,</tT> otherwise returns <TT Class="monofont">0.</tt> On error, returns <tt class="monofont">-1.</tt> This is equivalent to the Python expression  <tt claSs="monofont">"value in o".</tT></p>

					<prE>
						
int PySequence_Index(PyObject *o, PyObject *value)

					</pre>

					<p>Returns the first index <Tt clASS="monofont">i</Tt> for which <tt cLASS="monofont">o[i] == value.</tt> On error, returns <tt CLASs="monofont">-1.</tt> This is equivalent to the Python expression <tT CLAss="monofont">"o.index(value)".</tt><a name="idx1073751056"></a><a name="idx1073751057"></a><a namE="idx1073751058"></a><a Name="idx1073751059"></A></p>

				
				<h4>Mapping Protocol</h4>
					<pRe>
						
int PyMapping_Check(PyObject *o)

					</prE>

					<P>Returns <TT clasS="monofont">1</TT> if the object provides mapping protocol, and <Tt claSS="monofont">0</TT> otherwise. This function always succeeds.</p>

					<pre>
						
int PyMapping_Length(PyObject *o)

					</PRE>

					<P>Returns the number of keys in object <tt class="monofont">o</tt> on success, and <tt class="monofont">-1</tt> on failure. For objects that do not provide mapping protocol, this is equivalent to the Python expression <tt ClaSs="monofont">"len(o)".</tt></P>

					<pre>
						
int PyMapping_DelItemString(PyObject *o, char *key)

					</pRe>

					<p>Removes the mapping for object key from the object <tT CLAss="monofont">o.</tt> Returns <TT CLass="monofont">-1</tT> on failure. This is equivalent to the Python statement <TT Class="monofont">"del o[key]".</TT></P>

					<Pre>
						
int PyMapping_DelItem(PyObject *o, PyObject *key)

					</pre>

					<p>Removes the mapping for object key from the object <tt class="monofont">o.</tt> Returns <tt claSs="monofont">-1</tT> on failure. This is equivalent to the Python statement <tt cLass="monofont">"del o[key]".</tT></p>

					<prE>
						
int PyMapping_HasKeyString(PyObject *o, char *key)

					</PRE>

					<p>On success, returns <tt cLASS="monofont">1</tt> if the mapping object has the key identified by the <tt CLASs="monofont">key pointer,</tt> and <tT CLAss="monofont">0</tt> otherwise. This is equivalent to the Python expression <tt class="monofont">"o.has_key(key)".</tt> This function always succeeds.</p>

					<pre>
						
int PyMapping_HasKey(PyObject *o, PyObject *key)

					</pre>

					<P>Returns <tt ClasS="monofont">1</tt> if the mapping object has the key identified by the <tt ClasS="monofont">key pointer</TT> and <Tt claSS="monofont">0</TT> otherwise. This is equivalent to the Python expression <tt clASS="monofont">"o.has_key(key)".</Tt> This function always succeeds.</p>

					<prE>
						
PyObject* PyMapping_Keys(PyObject *o)

					</PRE>

					<p>Return value: New reference. On success, returns a list of the keys in object <tt class="monofont">o.</tt> On failure, returns <tt class="monofont">NULL.</tt> This is equivalent to the Python expression <tT clAss="monofont">"o.keys()".</tT></p>

					<pre>
						
PyObject* PyMapping_Values(PyObject *o)

					</Pre>

					<p>Return value: New reference. On success, returns a list of the values in object <TT CLass="monofont">o.</tT> On failure, returns <TT Class="monofont">NULL.</TT> This is equivalent to the Python expression <TT clasS="monofont">"o.values()".</TT></P>

					<pre>
						
PyObject* PyMapping_Items(PyObject *o)

					</pre>

					<p>Return value: New reference. On success, returns a list of the items in object <tt class="monofont">o,</tt> where each item is a tuple containing a key-value pair. On failure, returns <tt clAss="monofont">NULL.</Tt> This is equivalent to the Python expression <tt Class="monofont">"o.items()".</Tt></p>

					<pRE>
						
PyObject* PyMapping_GetItemString(PyObject *o, char *key)

					</PRe>

					<p>Return value: New reference. Returns element of <tt CLASs="monofont">o</tt> corresponding to the object key or <tT CLAss="monofont">NULL</tt> on failure. This is the equivalent of the Python expression <TT CLass="monofont">"o[key]".</tt></p>

					<pre>
						
int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v)

					</pre>

					<p>Maps the object key to the value <tt class="monofont">v</Tt> in object <tT claSs="monofont">o.</tt> Returns <tT claSS="monofont">-1</TT> on failure. This is the equivalent of the Python statement <tt clASS="monofont">"o[key] = v".</Tt><a naME="idx1073751060"></A><A name="idx1073751061"></A><A NAme="idx1073751062"></a><a name="idx1073751063"></a><a name="idx1073751064"></a><a name="idx1073751065"></A><a nAme="idx1073751066"></a><A name="idx1073751067"></A><a naME="idx1073751068"></A><A name="idx1073751069"></A><A NAme="idx1073751070"></a></p>

				
			</FONT>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 1/30/2002<br>Python Developer's Handbook, &copy;&nbsp;2002 Sams Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="262.html" title="Utilities"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=263" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="263.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="264.html" title="Concrete Objects Layer"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
</TD></TR></TABLE>
<br><TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD><H4 class=Title>Index terms contained in this section</H4>
<font size=2>
 <a href="#idx1073751013">Abstract Objects Layer, Python/C Application Programmers Interface (API)</a> <a href="#idx1073751024">2nd</a> <a href="#idx1073751035">3rd</a> <a href="#idx1073751050">4th</a> <a href="#idx1073751065">5th</a><BR>
Application Programmers Interface (API)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Python/C<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751009">Abstract Objects Layer</a> <a href="#idx1073751020">2nd</a> <a href="#idx1073751031">3rd</a> <a href="#idx1073751046">4th</a> <a href="#idx1073751061">5th</a><BR>
functions<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751007">object interactions</a> <a href="#idx1073751018">2nd</a> <a href="#idx1073751029">3rd</a> <a href="#idx1073751040">4th</a> <a href="#idx1073751044">5th</a> <a href="#idx1073751055">6th</a> <a href="#idx1073751059">7th</a> <a href="#idx1073751070">8th</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protocols<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751069">mapping</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751017">number</a> <a href="#idx1073751028">2nd</a> <a href="#idx1073751039">3rd</a> <a href="#idx1073751043">4th</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751006">object</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751054">sequence</a> <a href="#idx1073751058">2nd</a><BR>
interactions<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751012">objects, Python/C Application Programmers Interface (API)</a> <a href="#idx1073751023">2nd</a> <a href="#idx1073751034">3rd</a> <a href="#idx1073751049">4th</a> <a href="#idx1073751064">5th</a><BR>
interfaces<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Python/C Application Programmers (API)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751010">Abstract Objects Layer</a> <a href="#idx1073751021">2nd</a> <a href="#idx1073751032">3rd</a> <a href="#idx1073751047">4th</a> <a href="#idx1073751062">5th</a><BR>
layers<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751014">Abstract Objects, Python/C Application Programmers Interface (API)</a> <a href="#idx1073751025">2nd</a> <a href="#idx1073751036">3rd</a> <a href="#idx1073751051">4th</a> <a href="#idx1073751066">5th</a><BR>
 <a href="#idx1073751067">mapping protocol</a><BR>
 <a href="#idx1073751015">number protocol</a> <a href="#idx1073751026">2nd</a> <a href="#idx1073751037">3rd</a> <a href="#idx1073751041">4th</a><BR>
 <a href="#idx1073751004">object protocol</a><BR>
objects<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751011">interactions with, Python/C Application Programmers Interface (API)</a> <a href="#idx1073751022">2nd</a> <a href="#idx1073751033">3rd</a> <a href="#idx1073751048">4th</a> <a href="#idx1073751063">5th</a><BR>
protocols<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751068">mapping</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751016">number</a> <a href="#idx1073751027">2nd</a> <a href="#idx1073751038">3rd</a> <a href="#idx1073751042">4th</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751005">object</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751053">sequence</a> <a href="#idx1073751057">2nd</a><BR>
Python/C Application Programmers Interface (API)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073751008">Abstract Objects Layer</a> <a href="#idx1073751019">2nd</a> <a href="#idx1073751030">3rd</a> <a href="#idx1073751045">4th</a> <a href="#idx1073751060">5th</a><BR>
 <a href="#idx1073751052">sequence protocol</a> <a href="#idx1073751056">2nd</a><BR>
<BR>
</font></TD></TR></TABLE>




<!--EndOfBrowse-->

</TD></TR></TABLE>
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#990000><tr><td><p align=center><font size=1 face="verdana,arial,helvetica" color=white>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -