Python open() append and read, file.read() returns empty string
问题 Noticed an odd behavior when attempting to call read() on a file opened in a+ mode (Python 3.4.1) As seen here File mode for creating+reading+appending+binary It's possible to open a file in read/append mode supposedly . However This code: with open("hgrc", "a+") as hgrc: contents=hgrc.read() returns contents={str}'' . Which is unexpected based upon the answer posted above. Now, the following code with open("hgrc", "r+") as hgrc: contents=hgrc.read() returns contents={str}'contents of hgrc...