read mode, write mode vs. read method and write method
So, do I understand them correctly as the following? file = open ("filename", "r") # opens the file in the read mode, but doesn't read the file yet. file.read() #The file is read file = open ("filename", "w") # immediately erases the contents that were already there. This is different from the "r". file.write("This is the new contents written to the file that was emptied when being opened in a write mode") # write new contents in So in general, "read mode" does nothing to the file while "write mode" immediately erases the contents of the file. Is this correct? Thank you for your help, friends!