#!/usr/bin/env python
# *_* Coding=utf-8 *_*
"""
Desc: File Method
#############################
File.read () #read ([size]), read at the most size bytes, returned as a string.
File.readline () ReadLine ([size]), next line from the file, as a string.
File.readlines ()
ReadLines ([size]), List of strings, each a line from the file.
Call ReadLine () repeatedly and return a list of the lines so read.
The optional size argument, if given, is a approximate bound on the
Total number of bytes in the lines returned.
File.xreadlines () Xreadlines (), returns self.
File.write () write (str), None. Write string str to file.
File.writelines ()
Writelines (sequence_of_strings), None. Write the strings to the file.
Note that newlines is not added. The sequence can is any Iterable object
producing strings. This is equivalent to calling write () for each string.
File.truncate ()
Truncate ([size]), None. Truncate the file to in the most size bytes.
Size defaults to the current file position, as returned by Tell ().
File.seek ()
The Seek (offset [, whence]) method changes the position of the current file. The offset variable represents the number of bytes to move. The from variable specifies the reference position at which to begin moving bytes.
If from is set to 0, this means that the beginning of the file is used as the reference location for moving bytes. If set to 1, the current position is used as the reference location. If it is set to 2, then the end of the file will be used as the reference location.
File.flush ()
File.tell () Current file position, an integer (could be a long integer).
File.next ()
File.close ()
########### #不常用的方法 #############
File.closed
File.mode
File.name
File.isatty () # True or False. True if the file is connected to a TTY device.
File.readinto () #不用用这个
File.encoding # not used
File.errors # not used
File.newline # not used
File.softspace
File.fileno ()
Fileno (), integer "File descriptor".
This is needed for Lower-level file interfaces, such Os.read ().
###############################
version:1.0
"""
Fo= Open ("E:/temp.txt", ' R ')
Print "File name:", Fo.name
Print "is closed:", fo.closed
Print "Access mode:", Fo.mode
Print "whether to force a space at the end:", Fo.softspace
Python File method