<bdo id='siPoU'></bdo><ul id='siPoU'></ul>

    1. <i id='siPoU'><tr id='siPoU'><dt id='siPoU'><q id='siPoU'><span id='siPoU'><b id='siPoU'><form id='siPoU'><ins id='siPoU'></ins><ul id='siPoU'></ul><sub id='siPoU'></sub></form><legend id='siPoU'></legend><bdo id='siPoU'><pre id='siPoU'><center id='siPoU'></center></pre></bdo></b><th id='siPoU'></th></span></q></dt></tr></i><div id='siPoU'><tfoot id='siPoU'></tfoot><dl id='siPoU'><fieldset id='siPoU'></fieldset></dl></div>

      1. <small id='siPoU'></small><noframes id='siPoU'>

        <legend id='siPoU'><style id='siPoU'><dir id='siPoU'><q id='siPoU'></q></dir></style></legend>
        <tfoot id='siPoU'></tfoot>

        内置 open 函数中模式 a、a+、w、w+ 和 r+ 的区别?

        Difference between modes a, a+, w, w+, and r+ in built-in open function?(内置 open 函数中模式 a、a+、w、w+ 和 r+ 的区别?)
        <tfoot id='kkZe7'></tfoot>

        <small id='kkZe7'></small><noframes id='kkZe7'>

          • <bdo id='kkZe7'></bdo><ul id='kkZe7'></ul>
            • <i id='kkZe7'><tr id='kkZe7'><dt id='kkZe7'><q id='kkZe7'><span id='kkZe7'><b id='kkZe7'><form id='kkZe7'><ins id='kkZe7'></ins><ul id='kkZe7'></ul><sub id='kkZe7'></sub></form><legend id='kkZe7'></legend><bdo id='kkZe7'><pre id='kkZe7'><center id='kkZe7'></center></pre></bdo></b><th id='kkZe7'></th></span></q></dt></tr></i><div id='kkZe7'><tfoot id='kkZe7'></tfoot><dl id='kkZe7'><fieldset id='kkZe7'></fieldset></dl></div>
            • <legend id='kkZe7'><style id='kkZe7'><dir id='kkZe7'><q id='kkZe7'></q></dir></style></legend>

                  <tbody id='kkZe7'></tbody>

                  本文介绍了内置 open 函数中模式 a、a+、w、w+ 和 r+ 的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在python内置的open函数中,具体有什么区别在 waw+a+r+ 模式之间?

                  In the python built-in open function, what is the exact difference between the modes w, a, w+, a+, and r+?

                  特别是,文档暗示所有这些都将允许写入文件,并说它打开文件是为了附加"、写入"和更新",但没有定义这些术语的含义.

                  In particular, the documentation implies that all of these will allow writing to the file, and says that it opens the files for "appending", "writing", and "updating" specifically, but does not define what these terms mean.

                  推荐答案

                  打开方式与C标准库函数fopen()完全相同.

                  The opening modes are exactly the same as those for the C standard library function fopen().

                  BSD fopen 手册页 将它们定义如下:

                  The BSD fopen manpage defines them as follows:

                   The argument mode points to a string beginning with one of the following
                   sequences (Additional characters may follow these sequences.):
                  
                   ``r''   Open text file for reading.  The stream is positioned at the
                           beginning of the file.
                  
                   ``r+''  Open for reading and writing.  The stream is positioned at the
                           beginning of the file.
                  
                   ``w''   Truncate file to zero length or create text file for writing.
                           The stream is positioned at the beginning of the file.
                  
                   ``w+''  Open for reading and writing.  The file is created if it does not
                           exist, otherwise it is truncated.  The stream is positioned at
                           the beginning of the file.
                  
                   ``a''   Open for writing.  The file is created if it does not exist.  The
                           stream is positioned at the end of the file.  Subsequent writes
                           to the file will always end up at the then current end of file,
                           irrespective of any intervening fseek(3) or similar.
                  
                   ``a+''  Open for reading and writing.  The file is created if it does not
                           exist.  The stream is positioned at the end of the file.  Subse-
                           quent writes to the file will always end up at the then current
                           end of file, irrespective of any intervening fseek(3) or similar.
                  

                  这篇关于内置 open 函数中模式 a、a+、w、w+ 和 r+ 的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)

                    <bdo id='II6CH'></bdo><ul id='II6CH'></ul>
                      <tbody id='II6CH'></tbody>
                      <legend id='II6CH'><style id='II6CH'><dir id='II6CH'><q id='II6CH'></q></dir></style></legend>

                    • <small id='II6CH'></small><noframes id='II6CH'>

                        <i id='II6CH'><tr id='II6CH'><dt id='II6CH'><q id='II6CH'><span id='II6CH'><b id='II6CH'><form id='II6CH'><ins id='II6CH'></ins><ul id='II6CH'></ul><sub id='II6CH'></sub></form><legend id='II6CH'></legend><bdo id='II6CH'><pre id='II6CH'><center id='II6CH'></center></pre></bdo></b><th id='II6CH'></th></span></q></dt></tr></i><div id='II6CH'><tfoot id='II6CH'></tfoot><dl id='II6CH'><fieldset id='II6CH'></fieldset></dl></div>
                            <tfoot id='II6CH'></tfoot>