Say I have the following code:
remote = urlopen('www...../file.txt') with open(file='file', mode='wb') as local: local.write(remote.read()) Do I need to also do:
local.close() remote.close() How do I know when close() is needed and when Python takes care of it for me?
with, python takes care of it.withfor that as well, and it will be done automatically.urlopen?