File handling in python lets you open, read, write, append, modify files. Note: For the sake of this tutorial, we will assume that your text file and python code are present in the same directory.