Do I need to close connections in urllib2?

Possible duplicate:
Should I call close () after urllib.urlopen ()?
Are the objects created by urllib2.urlopen () a persistent join?

I have not seen any code samples in the Python documentation that indicate the need to close connections to remote servers.

import urllib2
handle = urllib2.urlopen('http://download.thinkbroadband.com/5MB.zip')
# ... do whatever

In the code above. When I finished, it’s not good for me to call close()on handle. What's going on here? Do I need to close the connection manually or is it closed to me?

+3
source share

All Articles