msvcrt-files.html

来自「一本很好的python的说明书,适合对python感兴趣的人」· HTML 代码 · 共 104 行

HTML
104
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>20.1.1 File Operations </title>
<META NAME="description" CONTENT="20.1.1 File Operations ">
<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="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.html">
<LINK REL="previous" href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">
<LINK REL="up" href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">
<LINK REL="next" href="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.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="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.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="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.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="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">20.1 msvcrt - Useful</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">20.1 msvcrt - Useful</A>
<b class="navlabel">Next:</b> <a class="sectref" href="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.html">20.1.2 Console I/O</A>
<br><hr></DIV>
<!--End of Navigation Panel-->

<H2>
<BR>
20.1.1 File Operations 
</H2>

<P>
<dl><dt><b><a name='l2h-3282'><tt class='function'>locking</tt></a></b> (<var>fd, mode, nbytes</var>)
<dd>
  Lock part of a file based on a file descriptor from the C runtime.
  Raises <tt class="exception">IOError</tt> on failure.
</dl>

<P>
<dl><dt><b><a name='l2h-3283'><tt class='function'>setmode</tt></a></b> (<var>fd, flags</var>)
<dd>
  Set the line-end translation mode for the file descriptor <var>fd</var>.
  To set it to text mode, <var>flags</var> should be <tt class="constant">os.O_TEXT</tt>;
  for binary, it should be <tt class="constant">os.O_BINARY</tt>.
</dl>

<P>
<dl><dt><b><a name='l2h-3284'><tt class='function'>open_osfhandle</tt></a></b> (<var>handle, flags</var>)
<dd>
  Create a C runtime file descriptor from the file handle
  <var>handle</var>.  The <var>flags</var> parameter should be a bit-wise OR of
  <tt class="constant">os.O_APPEND</tt>, <tt class="constant">os.O_RDONLY</tt>, and
  <tt class="constant">os.O_TEXT</tt>.  The returned file descriptor may be used as a
  parameter to <tt class="function">os.fdopen()</tt> to create a file object.
</dl>

<P>
<dl><dt><b><a name='l2h-3285'><tt class='function'>get_osfhandle</tt></a></b> (<var>fd</var>)
<dd>
  Return the file handle for the file descriptor <var>fd</var>.  Raises
  <tt class="exception">IOError</tt> if <var>fd</var> is not recognized.
</dl>

<P>

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.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="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.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="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.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="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">20.1 msvcrt - Useful</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-msvcrt.html" tppabs="http://www.python.org/doc/current/lib/module-msvcrt.html">20.1 msvcrt - Useful</A>
<b class="navlabel">Next:</b> <a class="sectref" href="msvcrt-console.html" tppabs="http://www.python.org/doc/current/lib/msvcrt-console.html">20.1.2 Console I/O</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 + =
减小字号Ctrl + -
显示快捷键?