Monday, 15 March 2010

python - creating an empty file and closing in one line -


I want to ensure that all the resources are being cleaned properly, is it a safe thing: < / P>

  Try: Close (Open Frame Path ("W")) Exception: Exception: Logger. Terror (Exception):   

Edit:

Actually, thinking about it, I also need to try / hold because I can log on to the highest level anyway to raise the exception. If there are errors on file making, then can anyone assume that there is nothing to stop?

You can use the statement to make sure that the file is closed in any case For example: (path_to_file, "w +") as: # f: #log exception / html>

No comments:

Post a Comment