[New-bugs-announce] [issue22651] Open file in a+ mode reads from end of file in Python 3.4

Nick Jacobson report at bugs.python.org
Thu Oct 16 09:57:11 CEST 2014


New submission from Nick Jacobson:

In Python 2.7.8.10 running the following gives one result:

    >>> with open(r"C:\myfile.txt", "a+") as f:
    ...     f.tell()
    ...
    0L

But in Python 3.4.1.0 it gives a different result:

    >>> with open(r"C:\myfile.txt", "a+") as f:
    ...     f.tell()
    ...
    98

According to the man page for fopen, for a+ mode: "The initial file position for reading is at the beginning of the file." Source: http://linux.die.net/man/3/fopen

----------
components: IO
messages: 229511
nosy: nicksjacobson
priority: normal
severity: normal
status: open
title: Open file in a+ mode reads from end of file in Python 3.4
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22651>
_______________________________________


More information about the New-bugs-announce mailing list