I want to understand why many people get bothered when using a
or a+
as built-in open()
function mode in a non-existing file.
Looking here and away in other questions, I can see them checking that file exists manually. If it does exist, then they will create the file using w
, otherwise they will use a
.
Some others use a+
saying it's the one that will create a new file and append text if it exists.
Finally, others are saying a
may not work (or maybe it's causing some bug under a Python version?) with open()
.
I tried open()
ing a file and appending with both a
and a+
parameters with a non-existing filename, and it creates a new file without problems. What's a really good explanation of this?