|
|
@ -477,7 +477,7 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span> |
|
|
|
<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs"><int> = ±<span class="hljs-number">0b</span><bin> <span class="hljs-comment"># Or: ±0x<hex></span> |
|
|
|
<int> = int(<span class="hljs-string">'±<bin>'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('±<hex>', 16)</span> |
|
|
|
<int> = int(<span class="hljs-string">'±0b<bin>'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('±0x<hex>', 0)</span> |
|
|
|
<str> = bin(<int>) <span class="hljs-comment"># Returns '[-]0b<bin>'.</span> |
|
|
|
<str> = bin(<int>) <span class="hljs-comment"># Returns '[-]0b<bin>'. Also hex().</span> |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs"><int> = <int> & <int> <span class="hljs-comment"># And (0b1100 & 0b1010 == 0b1000).</span> |
|
|
@ -1240,7 +1240,7 @@ error_msg = <span class="hljs-string">''</span>.join(traceback.format_exception( |
|
|
|
├── LookupError <span class="hljs-comment"># Base class for errors when a collection can't find an item.</span> |
|
|
|
│ ├── IndexError <span class="hljs-comment"># Raised when a sequence index is out of range.</span> |
|
|
|
│ └── KeyError <span class="hljs-comment"># Raised when a dictionary key or set element is missing.</span> |
|
|
|
├── MemoryError <span class="hljs-comment"># Out of memory. May be too late to start deleting objects.</span> |
|
|
|
├── MemoryError <span class="hljs-comment"># Out of memory. May be too late to start deleting variables.</span> |
|
|
|
├── NameError <span class="hljs-comment"># Raised when nonexistent name (variable/func/class) is used.</span> |
|
|
|
│ └── UnboundLocalError <span class="hljs-comment"># Raised when local name is used before it's being defined.</span> |
|
|
|
├── OSError <span class="hljs-comment"># Errors such as FileExistsError/TimeoutError (see #Open).</span> |
|
|
|