Difference between 2 styles of closing file in Python
Can somebody please explain the difference between the following?
handler = open(printFile, "w")
handler.close()
and
handler = open(prin开发者_StackOverflow中文版tFile, "w")
close(printFile)
The difference is pretty simple: The latter does not exist.
If it does in your application, it's user-defined and might just call firstArgument.close()
or do something else such as killing your dog.
精彩评论