Skip to main content
Engineering LibreTexts

5.12: Exercises

  • Page ID
    17072
  • Exercise \(\PageIndex{1}\)

    The urllib module provides methods for manipulating URLs and downloading information from the web. The following example downloads and prints a secret message from thinkpython.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