KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am having a great time trying to figure out why there doesn't need to be a closing attribute for this few lines of code I wrote: from sys import argv from os.path import exists script, from_file, to_file = argv file_content = open(from_file).read() new_file = open(to_file, 'w').write(file_content) new_file.close() file_content.close() I read some things and other people's posts about this, but their scripts were a lot more complicated than what I'm currently learning, so I couldn't figure out why. I am doing Learning Python the Hard Way and would appreciate any help.
Tags (comma-separated)
Save Edits
Cancel