#compsci #python File objects are Python code's main interface to external files on your computer ## Operations To create a text output file, pass in its name and the **'w' processing mode** string to write data: ```python f=open('data.txt','w') f.write('Hello there') f.close() ``` The most important methods here are: - **f.write()** - **f.close()** They are self-explanatory To read a file, pass in its name and the 'r' processing mode: ```python f=open('data.txt') # 'r' is the default processing mode text=f.read() # read entire file into a string ```