开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜