How does f=open('mytext.txt', 'w+') work?

Fredrik Lundh fredrik at
Sun Sep 18 18:56:13 CEST 2005

"Alex" wrote:

> If I open the file mytext.txt in Notepad I see something that begins
> with
> "My name is Bob  VwMÚ¸x¶ Ð"
> and goes on for approximately 4082 characters.
> What's happening??

you're moving the file pointer around in a new file, and you're getting
junk (from the stdio file buffers, most likely) in the places where you
haven't written anything yourself.


More information about the Python-list mailing list