Hello from the web.
This is collaborative work during class. Do not fill out early!
Sign in to Google to save your progress. Learn more
Consider the following code that reads and prints greetings from the web
import urllib2

if __name__ == '__main__':
    url = "http://www.cs.duke.edu/courses/fall17/compsci101/data/hello.txt"
    f = urllib2.urlopen(url)
    for line in f:
        print line
What type of variable is f? *
in url what do you think "data" is? *
Consider modifying the last two lines to change "line" to "foofoo".
import urllib2

if __name__ == '__main__':
    url = "http://www.cs.duke.edu/courses/fall17/compsci101/data/hello.txt"
    f = urllib2.urlopen(url)
    for foofoo in f:
        print foofoo
In the last two lines, if we change "line" to "foofoo", will the program still run? *
Could we change this program to read and print all the lines at the site nytimes.com? *
Names and netids below
Name: first and last of each person, comma separated *
Example: Pat Smith, Connor Jones
netid person 1 *
netid person 2
netid person 3
netid person 4
Submit
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy