Possible Duplicate:
Does filehandle get closed automatically in Python after it goes out of scope?
I am new to python. i know if you open a file and write it, you need to close it at the end.
in_file = open(from_file)
indata = in_file.read()
out_file = open(to_file, 'w')
out_file.write(indata)
out_file.close()
in_file.close()
if I write my code this way.
open(to_file, 'w').write(open(from_file).read())
I cannot really close it, will it be automatically closed?