I have try r+ and a+ to open file and read and write, but 'r+' and 'a+' are all append the str to the end of the file.
So, what's the difference between r+ and a+ ?
Add:
I have found the reason:
I have read the file object and forgot to seek(0) to set the location to the begin