In the python built-in open function, what is the exact difference between the modes w, a, w+, a+?
+4
A:
the opening modes are exacltly the same that C fopen() std library function.
AlberT
2009-09-23 13:33:20
I believe you mean the fopen call in the C standard library (which is not a system call)
Eli Courtwright
2009-09-23 13:34:08
+2
A:
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
Eli Courtwright
2009-09-23 13:33:37
+1
A:
What these flags means is explained in the documentation. http://docs.python.org/library/functions.html#open
Lennart Regebro
2009-09-23 13:54:44
always going to upvote the answer that references the language itself, -- and not some other esoteric pretender ;)
KevinDTimm
2009-09-23 14:14:21
@kevindtimm: What do you do for a question which references the answer as part of the question? Upvote it also?
S.Lott
2009-09-23 15:04:42
@S.Lott: Ha, you are right. He links to the docs. I didn't see that.Then I don't understand the question. His answer is in the doc that he links to.
Lennart Regebro
2009-09-23 15:51:47
@S. Lott, like Lennart, I didn't see that the OP was illiterate (the link was not obvious in his post).
KevinDTimm
2009-09-24 08:58:09
A:
shubham
2010-01-05 08:39:08