I’m a first time programmer, first time StackOverflow user, studying from Allen Downey’s free online text “Think Python”.
The code shown here is from exercise 14.5 (p.143). I’ve been trying to figure out what that .fp does; my searches all came up empty. I ran the code both with and without it and didn’t notice any difference in the results. I’d appreciate anyone’s help on this.
import urllib
conn = urllib.urlopen('http://thinkpython.com/secret.html')
for line in conn.fp:
print line.strip()
It’s just a faux file object attached to a socket object.
Read the docstring: