python2.7追加文件内容_Python3学习之路~2.7 文件操作

本文详细介绍了文件对象的各种操作方法,包括关闭文件、获取文件描述符、判断是否为控制台设备、读取和写入文件、定位文件位置、检查文件是否可读可写、截断文件等核心功能。这些方法对于理解和操作Python中的文件至关重要。
摘要由CSDN通过智能技术生成

def close(self): #real signature unknown; restored from __doc__

"""Close the file.

A closed file cannot be used for further I/O operations. close() may be

called more than once without error."""

pass

def fileno(self, *args, **kwargs): #real signature unknown

"""Return the underlying file descriptor (an integer)."""

pass

def isatty(self, *args, **kwargs): #real signature unknown

"""True if the file is connected to a TTY device."""

pass

def read(self, size=-1): #known case of _io.FileIO.read

"""注意,不一定能全读回来

Read at most size bytes, returned as bytes.

Only makes one system call, so less data may be returned than requested.

In non-blocking mode, returns None if no data is available.

Return an empty bytes object at EOF."""

return ""

def readable(self, *args, **kwargs): #real signature unknown

"""True if file was opened in a read mode."""

pass

def readall(self, *args, **kwargs): #real signature unknown

"""Read all data from the file, returned as bytes.

In non-blocking mode, returns as much as is immediately available,

or None if no data is available. Return an empty bytes object at EOF."""

pass

def readinto(self): #real signature unknown; restored from __doc__

"""Same as RawIOBase.readinto()."""

pass #不要用,没人知道它是干嘛用的

def seek(self, *args, **kwargs): #real signature unknown

"""Move to new file position and return the file position.

Argument offset is a byte count. Optional argument whence defaults to

SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values

are SEEK_CUR or 1 (move relative to current position, positive or negative),

and SEEK_END or 2 (move relative to end of file, usually negative, although

many platforms allow seeking beyond the end of a file).

Note that not all file objects are seekable."""

pass

def seekable(self, *args, **kwargs): #real signature unknown

"""True if file supports random-access."""

pass

def tell(self, *args, **kwargs): #real signature unknown

"""Current file position.

Can raise OSError for non seekable files."""

pass

def truncate(self, *args, **kwargs): #real signature unknown

"""Truncate the file to at most size bytes and return the truncated size.

Size defaults to the current file position, as returned by tell().

The current file position is changed to the value of size."""

pass

def writable(self, *args, **kwargs): #real signature unknown

"""True if file was opened in a write mode."""

pass

def write(self, *args, **kwargs): #real signature unknown

"""Write bytes b to file, return number written.

Only makes one system call, so not all of the data may be written.

The number of bytes actually written is returned. In non-blocking mode,

returns None if the write would block."""

pass

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值