File Methods
The following methods may be applied to a file object
f.read([n]) Read at most n bytes
f.readline() Read a single line of input
f.readlines() Read all input lines
f.write(s) Write string s
f.writelines(l) Write all strings in list l.
f.close() Close the file
f.tell() Return the current file pointer
f.seek(offset [,where]) Seek to a new position
f.isatty() Returns 1 if an interactive terminal
f.flush() Flush output buffers
f.truncate([n]) Truncate file to at most n bytes
f.fileno() Return integer file descriptor
Notes
- Line-oriented operations are aware of newline differences (Unix vs. Windows)
|