Browse Source

Exceptions

pull/61/head
Jure Šorn 4 years ago
parent
commit
a2e9060e21
2 changed files with 6 additions and 0 deletions
  1. 2
      README.md
  2. 4
      index.html

2
README.md

@ -1363,6 +1363,8 @@ else:
finally: finally:
<code_3> <code_3>
``` ```
* **Code inside the `'else'` block will only be executed if `'try'` block had no exception.**
* **Code inside the `'finally'` block will always be executed.**
### Catching Exceptions ### Catching Exceptions
```python ```python

4
index.html

@ -1301,6 +1301,10 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
&lt;code_3&gt; &lt;code_3&gt;
</code></pre></div> </code></pre></div>
<ul>
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'else'</span></code> block will only be executed if <code class="python hljs"><span class="hljs-string">'try'</span></code> block had no exception.</strong></li>
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'finally'</span></code> block will always be executed.</strong></li>
</ul>
<div><h3 id="catchingexceptions">Catching Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;: <div><h3 id="catchingexceptions">Catching Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;:
<span class="hljs-keyword">except</span> &lt;exception&gt; <span class="hljs-keyword">as</span> &lt;name&gt;: <span class="hljs-keyword">except</span> &lt;exception&gt; <span class="hljs-keyword">as</span> &lt;name&gt;:
<span class="hljs-keyword">except</span> (&lt;exception&gt;, ...): <span class="hljs-keyword">except</span> (&lt;exception&gt;, ...):

Loading…
Cancel
Save