[Tutor] Closing an urllib.urlopen
Tue, 2 Jan 2001 21:35:10 -0800 (PST)
On Tue, 2 Jan 2001, Timothy M. Brauch wrote:
> I've opened a web page in the following way:
> Do I have to close this? I know with files you don't necessarily need
> to close any files you open, but it is good to do so. Is it the same
> way with urlopen?
It's the same thing with urlopen() --- you don't have to close it, since
Python figures out when a resource becomes inaccessible and automatically
calls close(). Still, it can't hurt to do the close() manually.