File Handling in python is where you can read, write and edit files from within python. There are also different functions and modes in this as well. There is also another concept called modules where you can use functions from another file.

Image from Edureka.co

There are several modes and functions for file handling.

Append/Append Plus Mode

Append mode is where you can append something to your file. Append plus is where you also read it. In the next line you use the write functions. There is no append() function.

Read/Read Plus Mode

With this you can only display your file not edit it. Read plus is where you can also write. In the next line for this you use the read() function. There is also readlines and readline which reads a line or reads all line in your file.

Write/Write plus

In this you can write or edit a file. And write plus is where you also read after that. In the next line you use the read() function.

Close()

This step is very important this will close the file that you are accessing. If you don't close it and your code it wrong it will mess up the file.

Python Student