擅长:python、mysql、java
<p>使用<code>try</code>/<code>finally</code>来做<a href="http://docs.python.org/2/tutorial/errors.html#defining-clean-up-actions">clean-up</a>。如果需要处理操作系统级中断,请使用<a href="http://docs.python.org/2/library/signal.html">signals</a>。在</p>
<p><strong><code>Try</code>/<code>finally</code>示例</strong></p>
<pre><code>try:
create_temp_file()
finally:
delete_temp_file()
</code></pre>
<p><strong>信号示例</strong></p>
^{pr2}$