Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4dcf502

Browse files
committed
Use universal construct os.path.expanduser('~') instead of os.environ['HOME']
1 parent ebbf1e6 commit 4dcf502

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Doc/library/http.cookiejar.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ cookies (assumes Unix/Netscape convention for location of the cookies file)::
719719

720720
import os, http.cookiejar, urllib.request
721721
cj = http.cookiejar.MozillaCookieJar()
722-
cj.load(os.path.join(os.environ["HOME"], ".netscape/cookies.txt"))
722+
cj.load(os.path.join(os.path.expanduser("~"), ".netscape", "cookies.txt"))
723723
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
724724
r = opener.open("http://example.com/")
725725

Doc/library/readline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ normally be executed automatically during interactive sessions from the user's
197197

198198
import os
199199
import readline
200-
histfile = os.path.join(os.environ["HOME"], ".pyhist")
200+
histfile = os.path.join(os.path.expanduser("~"), ".pyhist")
201201
try:
202202
readline.read_history_file(histfile)
203203
except IOError:

0 commit comments

Comments
 (0)