Page 104 -
P. 104
textual data
You’re already using library code
Look at the first line of the original code:
This says that we are
going to use code stored in The urllib.request code
import urllib.request the “urllib.request” library.
The import line tells Python that you intend to use some library code
called urllib.request. A library is a bunch of prewritten code that
you can use in your own programs. In this case, the urllib.request
code accesses data on the Web. This is a library that comes as standard with
Python. urlopen()
To see how the code is used, look at this line:
page = urllib.request.urlopen("http://...")
Every library contains urlcleanup()
Library name. functions that you can
use in your own program.
The code that follows the = sign is calling a function in urllib.
request called urlopen(). Notice how we say we want the code:
urllib.request, followed by a “.”, then the name of the function.
urlretrieve()
<library-name> . <function-name>
But how will the time library help us? Let’s see...
you are here 4 69