当前位置: 首页>>代码示例>>Python>>正文


Python FileIO.__init__方法代码示例

本文整理汇总了Python中io.FileIO.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python FileIO.__init__方法的具体用法?Python FileIO.__init__怎么用?Python FileIO.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.FileIO的用法示例。


在下文中一共展示了FileIO.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from io import FileIO [as 别名]
# 或者: from io.FileIO import __init__ [as 别名]
    def __init__(self, name, mode="rb", buffering=0):
        """file(name[, mode[, buffering]]) -> file object

        Open a file.  The mode can be 'r', 'w' or 'a' for reading (default),
        writing or appending.  The file will be created if it doesn't exist
        when opened for writing or appending; it will be truncated when
        opened for writing.  Add a 'b' to the mode for binary files.
        Add a '+' to the mode to allow simultaneous reading and writing.
        If the buffering argument is given, 0 means unbuffered, 1 means line
        buffered, and larger numbers specify the buffer size.  The preferred way
        to open a file is with the builtin open() function.
        Add a 'U' to mode to open the file for input with universal newline
        support.  Any line ending in the input file will be seen as a '\n'
        in Python.  Also, a file so opened gains the attribute 'newlines';
        the value for this attribute is one of None (no newline read yet),
        '\r', '\n', '\r\n' or a tuple containing all the newline types seen.

        'U' cannot be combined with 'w' or '+' mode.
        """
        if six.PY2:
            FileIO.__init__(self, name, mode, buffering)
        else:  # for python3 we drop buffering
            FileIO.__init__(self, name, mode)
        self.lock = _Semaphore()
        self.__size = None
开发者ID:aglie,项目名称:fabio,代码行数:27,代码来源:fabioutils.py

示例2: __init__

# 需要导入模块: from io import FileIO [as 别名]
# 或者: from io.FileIO import __init__ [as 别名]
    def __init__(self, filename, nstates=-1, natoms=-1, vendor="PyMOL", box=None):
        file.__init__(self, filename, "w")
        self.natoms = natoms
        self.box = box

        # Write Trajectory Header Information
        print("TITLE : Created by %s with %d atoms" % (vendor, natoms), file=self)
开发者ID:speleo3,项目名称:pymol-psico,代码行数:9,代码来源:exporting.py

示例3: __init__

# 需要导入模块: from io import FileIO [as 别名]
# 或者: from io.FileIO import __init__ [as 别名]
    def __init__(self, fname, endian='@', header_prec='i', *args, **kwargs):
        """Open a Fortran unformatted file for writing.
        
        Parameters
        ----------
        endian : character, optional
            Specify the endian-ness of the file.  Possible values are
            '>', '<', '@' and '='.  See the documentation of Python's
            struct module for their meanings.  The deafult is '>' (native
            byte order)
        header_prec : character, optional
            Specify the precision used for the record headers.  Possible
            values are 'h', 'i', 'l' and 'q' with their meanings from
            Python's struct module.  The default is 'i' (the system's
            default integer).

        """
        file.__init__(self, fname, *args, **kwargs)
        self.ENDIAN = endian
        self.HEADER_PREC = header_prec
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:22,代码来源:fortranfile.py

示例4: __init__

# 需要导入模块: from io import FileIO [as 别名]
# 或者: from io.FileIO import __init__ [as 别名]
 def __init__(self, prog, *args, **kwargs):
     FileIO.__init__(self, *args, **kwargs)
     self.prog = prog
开发者ID:BoPeng,项目名称:SOS,代码行数:5,代码来源:utils.py


注:本文中的io.FileIO.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。