[Python-checkins] bpo-46079: Replace external link that is down for maintenance. (GH-30315)

rhettinger webhook-mailer at python.org
Sat Jan 1 12:50:04 EST 2022


https://github.com/python/cpython/commit/ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2
commit: ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2
branch: main
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022年01月01日T09:49:55-08:00
summary:
bpo-46079: Replace external link that is down for maintenance. (GH-30315)
files:
M Doc/tutorial/stdlib.rst
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index bad750424c8e8..d90dc51c71927 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -178,13 +178,13 @@ protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
 from URLs and :mod:`smtplib` for sending mail::
 
 >>> from urllib.request import urlopen
- >>> with urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') as response:
+ >>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as response:
 ... for line in response:
- ... line = line.decode('utf-8') # Decoding the binary data to text.
- ... if 'EST' in line or 'EDT' in line: # look for Eastern Time
- ... print(line)
-
- <BR>Nov. 25, 09:43:32 PM EST
+ ... line = line.decode() # Convert bytes to a str
+ ... if line.startswith('datetime'):
+ ... print(line.rstrip()) # Remove trailing newline
+ ...
+ datetime: 2022年01月01日T01:36:47.689215+00:00
 
 >>> import smtplib
 >>> server = smtplib.SMTP('localhost')


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /