<str> = chr(<int>) # Converts int to Unicode character.
<int> = ord(<str>) # Converts Unicode character to int.
```
* **Use `'unicodedata.normalize("NFC", <str>)'` on strings that may contain characters like `'Ö'` before comparing them, because they can be stored as one or two characters.**
* **Use `'unicodedata.normalize("NFC", <str>)'` on strings like `'Motörhead'` before comparing them to other strings, because `'ö'` can be stored as one or two characters.**
* **`'NFC'` converts such characters to a single character, while `'NFD'` converts them to two.**
### Property Methods
```python
<bool> = <str>.isdecimal() # Checks for [0-9].
<bool> = <str>.isdigit() # Checks for [²³¹] and isdecimal().
<bool> = <str>.isnumeric() # Checks for [¼½¾] and isdigit().
<bool> = <str>.isalnum() # Checks for [a-zA-Z] and isnumeric().
<bool> = <str>.isdecimal() # Checks for [0-9]. Also [०-९] and [٠-٩].
<bool> = <str>.isdigit() # Checks for [²³¹…] and isdecimal().
<bool> = <str>.isnumeric() # Checks for [¼½¾], [零〇一…] and isdigit().
<bool> = <str>.isalnum() # Checks for [a-zA-Z…] and isnumeric().
<bool> = <str>.isprintable() # Checks for [ !#$%…] and isalnum().
<bool> = <str>.isspace() # Checks for [ \t\n\r\f\v\x1c-\x1f\x85\xa0…].
```
@ -2194,17 +2194,19 @@ match <object/expression>:
### Patterns
```python
<value_pattern> = 1/'abc'/True/None/math.pi # Matches the literal or a dotted name.
<class_pattern> = <type>() # Matches any object of that type.
<capture_patt> = <name> # Matches any object and binds it to name.
<or_pattern> = <pattern> | <pattern> [| ...] # Matches any of the patterns.
<as_pattern> = <pattern> as <name> # Binds the match to the name.
<sequence_patt> = [<pattern>, ...] # Matches sequence with matching items.
<int> = ord(<str>) <spanclass="hljs-comment"># Converts Unicode character to int.</span>
</code></pre>
<ul>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'unicodedata.normalize("NFC", <str>)'</span></code> on strings that may contain characters like <codeclass="python hljs"><spanclass="hljs-string">'Ö'</span></code> before comparing them, because they can be stored as one or two characters.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'unicodedata.normalize("NFC", <str>)'</span></code> on strings like <codeclass="python hljs"><spanclass="hljs-string">'Motörhead'</span></code> before comparing them to other strings, because <codeclass="python hljs"><spanclass="hljs-string">'ö'</span></code> can be stored as one or two characters.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'NFC'</span></code> converts such characters to a single character, while <codeclass="python hljs"><spanclass="hljs-string">'NFD'</span></code> converts them to two.</strong></li>
</ul>
<div><h3id="propertymethods">Property Methods</h3><pre><codeclass="python language-python hljs"><bool> = <str>.isdecimal() <spanclass="hljs-comment"># Checks for [0-9].</span>
<bool> = <str>.isdigit() <spanclass="hljs-comment"># Checks for [²³¹] and isdecimal().</span>
<bool> = <str>.isnumeric() <spanclass="hljs-comment"># Checks for [¼½¾] and isdigit().</span>
<bool> = <str>.isalnum() <spanclass="hljs-comment"># Checks for [a-zA-Z] and isnumeric().</span>
<div><h3id="propertymethods">Property Methods</h3><pre><codeclass="python language-python hljs"><bool> = <str>.isdecimal() <spanclass="hljs-comment"># Checks for [0-9]. Also [०-९] and [٠-٩].</span>
<bool> = <str>.isdigit() <spanclass="hljs-comment"># Checks for [²³¹…] and isdecimal().</span>
<bool> = <str>.isnumeric() <spanclass="hljs-comment"># Checks for [¼½¾], [零〇一…] and isdigit().</span>
<bool> = <str>.isalnum() <spanclass="hljs-comment"># Checks for [a-zA-Z…] and isnumeric().</span>
<bool> = <str>.isprintable() <spanclass="hljs-comment"># Checks for [ !#$%…] and isalnum().</span>
<bool> = <str>.isspace() <spanclass="hljs-comment"># Checks for [ \t\n\r\f\v\x1c-\x1f\x85\xa0…].</span>
<div><h3id="patterns">Patterns</h3><pre><codeclass="python language-python hljs"><value_pattern> = <spanclass="hljs-number">1</span>/<spanclass="hljs-string">'abc'</span>/<spanclass="hljs-keyword">True</span>/<spanclass="hljs-keyword">None</span>/math.pi <spanclass="hljs-comment"># Matches the literal or a dotted name.</span>
<class_pattern> = <type>() <spanclass="hljs-comment"># Matches any object of that type.</span>
<capture_patt> = <name><spanclass="hljs-comment"># Matches any object and binds it to name.</span>
<or_pattern> = <pattern> | <pattern> [| ...] <spanclass="hljs-comment"># Matches any of the patterns.</span>
<as_pattern> = <pattern><spanclass="hljs-keyword">as</span><name><spanclass="hljs-comment"># Binds the match to the name.</span>
<sequence_patt> = [<pattern>, ...] <spanclass="hljs-comment"># Matches sequence with matching items.</span>
<class_pattern> = <type>(<attr_name>=<patt>, ...) <spanclass="hljs-comment"># Matches object with matching attributes.</span>
<div><h3id="patterns">Patterns</h3><pre><codeclass="python language-python hljs"><value_pattern> = <spanclass="hljs-number">1</span>/<spanclass="hljs-string">'abc'</span>/<spanclass="hljs-keyword">True</span>/<spanclass="hljs-keyword">None</span>/math.pi <spanclass="hljs-comment"># Matches the literal or a dotted name.</span>
<class_pattern> = <type>() <spanclass="hljs-comment"># Matches any object of that type.</span>
<wildcard_patt> = _ <spanclass="hljs-comment"># Matches any object.</span>
<capture_patt> = <name><spanclass="hljs-comment"># Matches any object and binds it to name.</span>
<or_pattern> = <pattern> | <pattern> [| ...] <spanclass="hljs-comment"># Matches any of the patterns.</span>
<as_pattern> = <pattern><spanclass="hljs-keyword">as</span><name><spanclass="hljs-comment"># Binds the match to the name.</span>
<sequence_patt> = [<pattern>, ...] <spanclass="hljs-comment"># Matches sequence with matching items.</span>
<class_pattern> = <type>(<attr_name>=<patt>, ...) <spanclass="hljs-comment"># Matches object with matching attributes.</span>
</code></pre></div>
<ul>
<li><strong>Sequence pattern can also be written as a tuple.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">'*<name>'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'**<name>'</span></code> in sequence/mapping patterns to bind remaining items.</strong></li>
<li><strong>Sequence pattern must match all items, while mapping pattern does not.</strong></li>
<li><strong>Patterns can be surrounded with brackets to override precedence (<codeclass="python hljs"><spanclass="hljs-string">'|'</span></code>><codeclass="python hljs"><spanclass="hljs-string">'as'</span></code>><codeclass="python hljs"><spanclass="hljs-string">','</span></code>).</strong></li>
<li><strong>Built-in types allow a single positional pattern that is matched against the entire object.</strong></li>
<li><strong>All names that are bound in the matching case, as well as variables initialized in its block, are visible after the match statement.</strong></li>