STINNER Victor added the comment: Python 3 documentation is explicit about the "a" mode: "open for writing, appending *to the end* of the file if it exists" https://docs.python.org/dev/library/functions.html#open
Python 2 is based on the stdio.h of the C standard library which behaves differently. fopen() documentation: "Open for appending (writing *at end of file*). http://linux.die.net/man/3/fopen IMO it's a bug in the C library. It's probably yet another bug in the C standard library on Windows: http://haypo-notes.readthedocs.org/python.html#bugs-in-the-c-stdio-used-by-the-python-i-o ---------- components: +Windows nosy: +haypo, pitrou, steve.dower, tim.golden, zach.ware title: Open file in a+ mode reads from end of file in Python 3.4 -> Python 2: Open file in a+ mode on Windows doesn't go to the end _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22651> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com