In the python built-in open function, what is the exact difference between the modes w, a, w+, a+, and r+?>
The options are the same as for the fopen function in the C standard library:
w truncates the file, overwriting whatever was already there
a appends to the file, adding onto whatever was already there
w+ opens for reading and writing, truncating the file but also allowing you to read back what's been written to the file
a+ opens for appending and reading, allowing you both to append to the file and also read its contents