0
The arguments of file open?
Arguments like r, w, a, wb, rb are there, but I want to exact difference between write and append
3 Answers
+ 1
write overwrites the contents of the file (essentially creates a new file), append keeps the existing content (begins at the last line of the file).
0
Here are the opening modes:
r -> read
w -> write (if file doesn't exist, create it, otherwise, empty it)
a -> appends at the end of the file
b -> binary mode, useful i f you use something like pickle
there is also:
+ -> update (not recommended, you have full access to the file in read/write mode)
x -> creates the file. If it already exists, throws an error
0
Would you be so kind as to mark my response as the answer? This is the check mark next to my response. Thank you.