Skip to content

Commit 2bd7354

Browse files
bpo-46079: Replace external link that is down for maintenance. (GH-30315) (GH-30328)
1 parent 1b37268 commit 2bd7354

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/tutorial/stdlib.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
178178
from URLs and :mod:`smtplib` for sending mail::
179179

180180
>>> from urllib.request import urlopen
181-
>>> with urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') as response:
181+
>>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as response:
182182
... for line in response:
183-
... line = line.decode('utf-8') # Decoding the binary data to text.
184-
... if 'EST' in line or 'EDT' in line: # look for Eastern Time
185-
... print(line)
186-
187-
<BR>Nov. 25, 09:43:32 PM EST
183+
... line = line.decode() # Convert bytes to a str
184+
... if line.startswith('datetime'):
185+
... print(line.rstrip()) # Remove trailing newline
186+
...
187+
datetime: 2022-01-01T01:36:47.689215+00:00
188188

189189
>>> import smtplib
190190
>>> server = smtplib.SMTP('localhost')

0 commit comments

Comments
 (0)