Currency Converter 121
The Python standard library has many modules that provide networking facilities. We saw one example of a standard library networking function back in Chapter 4, when we used
urllib2.urlopen() to provide a “file handle” to a file on the Internet that we then read line by line using the
for line in fh: idiom. It is also possible to just “grab” an entire file from the Internet:
source = "http://www.amk.ca/files/python/crypto/" + \ "pycrypto-2.0.1.tar.gz"target = source[source.rfind("/") + 1:]name, message = urllib.urlretrieve(source, target)
name holds ...