Open a file for input/output.
filename The name of the file to be opened.
mode The mode in which the file is to be opened.
fi An integer that can be used subsequently to refer to this file. The integer is a valid reference as long as the file has not been closed.

The input mode is one of the strings "w", "r", "wb", and "rb", for, reading ("r" ), writing ("w" ) in the text mode, or reading ("rb" ), writing ("wb" ) in the binary mode.