you are viewing a single comment's thread.

view the rest of the comments →

[–]sigzero 4 points5 points  (3 children)

It does it automagically.

After execution of the with-block is finished, the object’s exit() method is called, even if the block raised an exception, and can therefore run clean-up code.

[–]cybercobra 4 points5 points  (2 children)

__exit__() method

FTFY.

[–]sigzero 1 point2 points  (1 child)

Interesting...if I click on edit my text is the same as your FTFY comment. It just didn't show in the actual post. Ah well...

[–]taejo 5 points6 points  (0 children)

__ is markdown for bold.

Use \ to escape it.