diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-01-01 17:49:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 17:49:55 (GMT) |
commit | ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2 (patch) | |
tree | 0a5eb02ccf449befc4660ce2e0585111a6dfce51 /Doc/tutorial | |
parent | 0b58bac3e7877d722bdbd3c38913dba2cb212f13 (diff) | |
download | cpython-ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2.zip cpython-ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2.tar.gz cpython-ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2.tar.bz2 |
bpo-46079: Replace external link that is down for maintenance. (GH-30315)
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/stdlib.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst index bad7504..d90dc51 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-01T01:36:47.689215+00:00 >>> import smtplib >>> server = smtplib.SMTP('localhost') |