O'Reilly logo
  • You Wang thinks this is interesting:

Note that there is an important difference between 'r+' and 'w+': the latter will truncate the file, while the former will not.

From

Cover of Beginning Python: From Novice to Professional, 3rd Edition

Note

'w+' will truncate the file