Available under Creative Commons-NonCommercial-ShareAlike 4.0 International License.
Exercise 14.6.Theurllibmodule provides methods for manipulating URLs and downloading information from the web. The following example downloads and prints a secret message fromthinkpython.com:
import urllib conn = urllib.urlopen('http://thinkpython.com/secret.html') for line in conn: print line.strip()
Run this code and follow the instructions you see there. Solution: http: // thinkpython. com/code/ zip_ code. py.
- 瀏覽次數:2044