Skip to content

Commit d044e60

Browse files
committed
Dictionary, String, Numbers
1 parent 5196ca5 commit d044e60

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ value = <dict>.setdefault(key, default=None) # Returns and writes default if
104104
<dict>.update(<dict>) # Adds items. Replaces ones with matching keys.
105105
value = <dict>.pop(key) # Removes item or raises KeyError if missing.
106106
{k for k, v in <dict>.items() if v == value} # Returns set of keys that point to the value.
107-
{k: v for k, v in <dict>.items() if k in keys} # Filters the dictionary by keys.
107+
{k: v for k, v in <dict>.items() if k in keys} # Filters the dictionary by specified keys.
108108
```
109109

110110
### Counter
@@ -350,7 +350,7 @@ String
350350
<bool> = <str>.isnumeric() # Checks for [¼½¾…], [零〇一…] and isdigit().
351351
<bool> = <str>.isalnum() # Checks for [a-zA-Z…] and isnumeric().
352352
<bool> = <str>.isprintable() # Checks for [ !#$%…] and isalnum().
353-
<bool> = <str>.isspace() # Checks for [ \t\n\r\f\v\x1c-\x1f\x85\xa0…].
353+
<bool> = <str>.isspace() # Checks for [ \t\n\r\f\v\x1c-\x1f\x85…].
354354
```
355355

356356

@@ -554,7 +554,7 @@ shuffle(<list>) # Works on all mutable sequences.
554554
<int> = <int> & <int> # E.g. `0b1100 & 0b1010 == 0b1000`.
555555
<int> = <int> | <int> # E.g. `0b1100 | 0b1010 == 0b1110`.
556556
<int> = <int> ^ <int> # E.g. `0b1100 ^ 0b1010 == 0b0110`.
557-
<int> = <int> << n_bits # E.g. `0b1100 << 4 == 0b1100_0000`.
557+
<int> = <int> << n_bits # E.g. `0b1111 << 4 == 0b11110000`.
558558
<int> = ~<int> # E.g. `~0b1 == -0b10 == -(0b1+1)`.
559559
```
560560

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
<pre><code class="python language-python hljs">&lt;dict&gt;.update(&lt;dict&gt;) <span class="hljs-comment"># Adds items. Replaces ones with matching keys.</span>
166166
value = &lt;dict&gt;.pop(key) <span class="hljs-comment"># Removes item or raises KeyError if missing.</span>
167167
{k <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> &lt;dict&gt;.items() <span class="hljs-keyword">if</span> v == value} <span class="hljs-comment"># Returns set of keys that point to the value.</span>
168-
{k: v <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> &lt;dict&gt;.items() <span class="hljs-keyword">if</span> k <span class="hljs-keyword">in</span> keys} <span class="hljs-comment"># Filters the dictionary by keys.</span>
168+
{k: v <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> &lt;dict&gt;.items() <span class="hljs-keyword">if</span> k <span class="hljs-keyword">in</span> keys} <span class="hljs-comment"># Filters the dictionary by specified keys.</span>
169169
</code></pre>
170170
<div><h3 id="counter">Counter</h3><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> Counter
171171
<span class="hljs-meta">&gt;&gt;&gt; </span>counter = Counter([<span class="hljs-string">'blue'</span>, <span class="hljs-string">'blue'</span>, <span class="hljs-string">'blue'</span>, <span class="hljs-string">'red'</span>, <span class="hljs-string">'red'</span>])
@@ -335,7 +335,7 @@
335335
&lt;bool&gt; = &lt;str&gt;.isnumeric() <span class="hljs-comment"># Checks for [¼½¾…], [零〇一…] and isdigit().</span>
336336
&lt;bool&gt; = &lt;str&gt;.isalnum() <span class="hljs-comment"># Checks for [a-zA-Z…] and isnumeric().</span>
337337
&lt;bool&gt; = &lt;str&gt;.isprintable() <span class="hljs-comment"># Checks for [ !#$%…] and isalnum().</span>
338-
&lt;bool&gt; = &lt;str&gt;.isspace() <span class="hljs-comment"># Checks for [ \t\n\r\f\v\x1c-\x1f\x85\xa0…].</span>
338+
&lt;bool&gt; = &lt;str&gt;.isspace() <span class="hljs-comment"># Checks for [ \t\n\r\f\v\x1c-\x1f\x85…].</span>
339339
</code></pre></div>
340340

341341
<div><h2 id="regex"><a href="#regex" name="regex">#</a>Regex</h2><p><strong>Functions for regular expression matching.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> re
@@ -502,7 +502,7 @@
502502
<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs">&lt;int&gt; = &lt;int&gt; &amp; &lt;int&gt; <span class="hljs-comment"># E.g. `0b1100 &amp; 0b1010 == 0b1000`.</span>
503503
&lt;int&gt; = &lt;int&gt; | &lt;int&gt; <span class="hljs-comment"># E.g. `0b1100 | 0b1010 == 0b1110`.</span>
504504
&lt;int&gt; = &lt;int&gt; ^ &lt;int&gt; <span class="hljs-comment"># E.g. `0b1100 ^ 0b1010 == 0b0110`.</span>
505-
&lt;int&gt; = &lt;int&gt; &lt;&lt; n_bits <span class="hljs-comment"># E.g. `0b1100 &lt;&lt; 4 == 0b1100_0000`.</span>
505+
&lt;int&gt; = &lt;int&gt; &lt;&lt; n_bits <span class="hljs-comment"># E.g. `0b1111 &lt;&lt; 4 == 0b11110000`.</span>
506506
&lt;int&gt; = ~&lt;int&gt; <span class="hljs-comment"># E.g. `~0b1 == -0b10 == -(0b1+1)`.</span>
507507
</code></pre></div>
508508

0 commit comments

Comments
 (0)