From: Hirokazu Yamamoto Date: Sat, 28 Feb 2009 15:24:00 +0000 (+0000) Subject: Binary flag is needed on windows. X-Git-Tag: v2.7a1~1925 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02172ddbee4a07f053468844acb1f9442963e08e;p=python Binary flag is needed on windows. --- diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 09ec73b094..a6e9bdc855 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -99,10 +99,10 @@ memory but does not update the underlying file. import mmap # write a simple example file - with open("hello.txt", "w") as f: + with open("hello.txt", "wb") as f: f.write("Hello Python!\n") - with open("hello.txt", "r+") as f: + with open("hello.txt", "r+b") as f: # memory-map the file, size 0 means whole file map = mmap.mmap(f.fileno(), 0) # read content via standard file methods