Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
This is expected behaviour. You read from the position of the file pointer, not the beginning of the file, so after writing to to the file, you have to use the seek() method to return to the beginning if you want to read what you just wrote. https://docs.python.org/3/library/io.html https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects ---------- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38935> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com