mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Documentation updates for urllib package. Modified the documentation for the
urllib,urllib2 -> urllib.request,urllib.error urlparse -> urllib.parse RobotParser -> urllib.robotparser Updated tutorial references and other module references (http.client.rst, ftplib.rst,contextlib.rst) Updated the examples in the urllib2-howto Addresses Issue3142.
This commit is contained in:
parent
d11a44312f
commit
aca8fd7a9d
12 changed files with 565 additions and 593 deletions
|
|
@ -147,11 +147,11 @@ Internet Access
|
|||
===============
|
||||
|
||||
There are a number of modules for accessing the internet and processing internet
|
||||
protocols. Two of the simplest are :mod:`urllib2` for retrieving data from urls
|
||||
and :mod:`smtplib` for sending mail::
|
||||
protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
|
||||
from urls and :mod:`smtplib` for sending mail::
|
||||
|
||||
>>> import urllib2
|
||||
>>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
|
||||
>>> import urllib.request
|
||||
>>> for line in urllib.request.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
|
||||
... if 'EST' in line or 'EDT' in line: # look for Eastern Time
|
||||
... print(line)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue