Skip to content

Commit 6ac047e

Browse files
committed
Dictionary
1 parent 4c3cdeb commit 6ac047e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ value = <dict>.pop(key) # Removes item or raises KeyErro
9696
### Counter
9797
```python
9898
>>> from collections import Counter
99-
>>> colors = ['blue', 'red', 'blue', 'red', 'blue']
99+
>>> colors = ['blue', 'blue', 'blue', 'red', 'red']
100100
>>> counter = Counter(colors)
101101
>>> counter['yellow'] += 1
102102
Counter({'blue': 3, 'red': 2, 'yellow': 1})

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
{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"># Returns a dictionary, filtered by keys.</span>
280280
</code></pre>
281281
<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
282-
<span class="hljs-meta">&gt;&gt;&gt; </span>colors = [<span class="hljs-string">'blue'</span>, <span class="hljs-string">'red'</span>, <span class="hljs-string">'blue'</span>, <span class="hljs-string">'red'</span>, <span class="hljs-string">'blue'</span>]
282+
<span class="hljs-meta">&gt;&gt;&gt; </span>colors = [<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>]
283283
<span class="hljs-meta">&gt;&gt;&gt; </span>counter = Counter(colors)
284284
<span class="hljs-meta">&gt;&gt;&gt; </span>counter[<span class="hljs-string">'yellow'</span>] += <span class="hljs-number">1</span>
285285
Counter({<span class="hljs-string">'blue'</span>: <span class="hljs-number">3</span>, <span class="hljs-string">'red'</span>: <span class="hljs-number">2</span>, <span class="hljs-string">'yellow'</span>: <span class="hljs-number">1</span>})

pdf/how_to_create_pdf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Printing to PDF
2121
* Run `./parse.js` again.
2222
* Open `index.html` in text editor and first remove element `<p><br></p>` before the `<h1>Libraries</h1>`.
2323
* Then replace the footer and last three `<br>` elements with contents of `pdf/index_for_pdf_print.html` file and save.
24-
* Change all links in text to normal text. They can be found with this regex: `<strong>.*a href.*</strong>`.
24+
* Change all links in text to normal text and optionally add a page number after '(p. <num>)'. Links can be found with this regex: `<strong>.*a href.*</strong>`.
2525
* Open `index.html` in Chrome.
2626
* Change brightness of elements by right clicking on them and selecting inspect. Then click on the rectangle that represents color and toggle the color space to HSLA by clicking on the button with two vertical arrows.
2727
* Change lightness (L) percentage to:
@@ -43,7 +43,7 @@ Adding headers and footers to PDF (the same for both files)
4343
* In 'Change page size' section select 'A4' for 'Page Sizes' set 'XOffset' to '0.1 in' and select page range All.
4444
* Select 'Edit PDF' tab and add headers and footers by clicking 'Header & Footer' button, selecting a preset from 'Saved Settings' dropdown menu and clicking ok. Repeat the process for each preset.
4545
* If presets get lost, the font and the margins are as follow: Borders: left-line: 0.6, left-text: 0.8, top-line: 11.4, bottom-text: 0.27, right-text-odd: 0.57, font-name: menlo, font-size: 8.
46-
* Set title and author by selecting 'File/Propertiess...'.
46+
* Set title and author by selecting 'File/Properties...'.
4747
* Save.
4848

4949
Printing the PDF

0 commit comments

Comments
 (0)