18. Networking
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)
The name
holds ...
Get Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.