Use universal construct os.path.expanduser('~') instead of os.environ['HOME']
diff --git a/Doc/library/cookielib.rst b/Doc/library/cookielib.rst
index 47211c9..4ca0471 100644
--- a/Doc/library/cookielib.rst
+++ b/Doc/library/cookielib.rst
@@ -750,7 +750,7 @@
 
    import os, cookielib, urllib2
    cj = cookielib.MozillaCookieJar()
-   cj.load(os.path.join(os.environ["HOME"], ".netscape/cookies.txt"))
+   cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    r = opener.open("http://example.com/")
 
diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst
index f6e855e..64c61a2 100644
--- a/Doc/library/readline.rst
+++ b/Doc/library/readline.rst
@@ -211,7 +211,7 @@
 
    import os
    import readline
-   histfile = os.path.join(os.environ["HOME"], ".pyhist")
+   histfile = os.path.join(os.path.expanduser("~"), ".pyhist")
    try:
        readline.read_history_file(histfile)
    except IOError: