Antoine Pitrou added the comment: Why the complication? You could just use open mode "r+". ---------- nosy: +pitrou _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue21934> _______________________________________