The following methods can be applied to an open file f
f.read([n]) # Read at most n bytes
f.readline([n]) # Read a line of input with max length of n
f.readlines() # Read all input and return a list of lines
f.write(s) # Write string s
f.writelines(ls) # Write a list of strings
f.close() # Close a file
f.tell() # Return current file pointer
f.seek(offset [,where]) # Seek to a new position
# where = 0: Relative to start
# where = 1: Relative to current
# where = 2: Relative to end
f.isatty() # Return 1 if interactive terminal
f.flush() # Flush output
f.truncate([size]) # Truncate file to at most size bytes
f.fileno() # Return integer file descriptor