@ -279,7 +279,7 @@ value = <dict>.pop(key) <span class="hljs-comment"
{k: v <spanclass="hljs-keyword">for</span> k, v <spanclass="hljs-keyword">in</span><dict>.items() <spanclass="hljs-keyword">if</span> k <spanclass="hljs-keyword">in</span> keys} <spanclass="hljs-comment"># Returns a dictionary, filtered by keys.</span>
<li><strong>By default digits, whitespaces and alphanumerics from all alphabets are matched, unless <codeclass="python hljs"><spanclass="hljs-string">'flags=re.ASCII'</span></code> argument is used.</strong></li>
<li><strong>By default digits, alphanumerics and whitespaces from all alphabets are matched, unless <codeclass="python hljs"><spanclass="hljs-string">'flags=re.ASCII'</span></code> argument is used.</strong></li>
<li><strong>Use a capital letter for negation.</strong></li>
</ul><pre><codeclass="python language-python hljs"><spanclass="hljs-string">'\d'</span> == <spanclass="hljs-string">'[0-9]'</span><spanclass="hljs-comment"># Matches any digit.</span>
<spanclass="hljs-string">'\w'</span> == <spanclass="hljs-string">'[a-zA-Z0-9_]'</span><spanclass="hljs-comment"># Matches any alphanumeric.</span>
<div><h4id="comparisonofpresentationtypes">Comparison of presentation types:</h4><pre><codeclass="text language-text">+---------------+-----------------+-----------------+-----------------+-----------------+
<div><h4id="pythonhasmanydifferentiteratorobjects">Python has many different iterator objects:</h4><ul>
<li><strong>Objects returned by the <ahref="#iterator">iter()</a> function, such as list_iterator and set_iterator.</strong></li>
<li><strong>Iterators returned by the <ahref="#iterator">iter()</a> function, such as list_iterator and set_iterator.</strong></li>
<li><strong>Objects returned by the <ahref="#itertools">itertools</a> module, such as count, repeat and cycle.</strong></li>
<li><strong>Generators returned by the <ahref="#generator">generator functions</a> and <ahref="#comprehension">generator expressions</a>.</strong></li>
<li><strong>File objects returned by the <ahref="#open">open()</a> function, etc.</strong></li>
@ -1116,7 +1116,7 @@ Z = dataclasses.make_dataclass(<span class="hljs-string">'Z'</span>, [<span clas
<li><strong>Another solution in this particular case is to use built-in functions <codeclass="python hljs"><spanclass="hljs-string">'and_'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'or_'</span></code> from the module <ahref="#operator">operator</a>.</strong></li>
<li><strong>Another solution in this particular case is to use built-in functions and_() and or_() from the module <ahref="#operator">operator</a>.</strong></li>
+-- StopIteration # Raised by next() when run on an empty iterator.
+-- TypeError # Raised when an argument is of wrong type.
+-- ValueError # When an argument is of right type but inappropriate value.
+-- UnicodeError # Raised when encoding/decoding strings from/to bytes fails.
+-- UnicodeError # Raised when encoding/decoding strings to/from bytes fails.
</code></pre></div>
<div><h4id="collectionsandtheirexceptions">Collections and their exceptions:</h4><pre><codeclass="text language-text">+-----------+------------+------------+------------+
<li><strong>File must be opened with <codeclass="python hljs"><spanclass="hljs-string">'newline=""'</span></code> argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' linendings!</strong></li>
<li><strong>File must be opened with <codeclass="python hljs"><spanclass="hljs-string">'newline=""'</span></code> argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' line endings!</strong></li>
</ul>
<div><h3id="parameters">Parameters</h3><ul>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'dialect'</span></code> - Master parameter that sets the default values.</strong></li>
@ -1649,9 +1650,9 @@ db.close()
<div><h3id="read-1">Read</h3><p><strong>Returned values can be of type str, int, float, bytes or None.</strong></p><pre><codeclass="python language-python hljs"><cursor> = db.execute(<spanclass="hljs-string">'<query>'</span>) <spanclass="hljs-comment"># Can raise sqlite3.OperationalError.</span>
<div><h3id="read-1">Read</h3><p><strong>Returned values can be of type str, int, float, bytes or None.</strong></p><pre><codeclass="python language-python hljs"><cursor> = db.execute(<spanclass="hljs-string">'<query>'</span>) <spanclass="hljs-comment"># Raises a subclass of sqlite3.Error.</span>
<tuple> = <cursor>.fetchone() <spanclass="hljs-comment"># Returns next row. Also next(<cursor>).</span>
<spanclass="hljs-keyword">from</span> mysql <spanclass="hljs-keyword">import</span> connector
db = connector.connect(host=<str>, user=<str>, password=<str>, database=<str>)
<cursor> = db.cursor()
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>) <spanclass="hljs-comment"># Only cursor has execute method.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>) <spanclass="hljs-comment"># Raises a subclass of mysql.connector.Error.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>, <list/tuple>) <spanclass="hljs-comment"># Replaces '%s's in query with values.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>, <dict/namedtuple>) <spanclass="hljs-comment"># Replaces '%(<key>)s's with values.</span>
</code></pre></div>
@ -1735,11 +1736,11 @@ db = connector.connect(host=<str>, user=<str>, password=<str>,
</ul></div><div><h4id="integertypesuseacapitalletterforunsignedtypestandardsizesareinbrackets">Integer types. Use a capital letter for unsigned type. Standard sizes are in brackets:</h4><ul>
</ul></div></div><div><h4id="integertypesuseacapitalletterforunsignedtypestandardsizesareinbrackets">Integer types. Use a capital letter for unsigned type. Standard sizes are in brackets:</h4><ul>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'x'</span></code> - pad byte</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'h'</span></code> - short (2)</strong></li>
@ -1757,8 +1758,9 @@ db = connector.connect(host=<str>, user=<str>, password=<str>,
<div><h2id="array"><ahref="#array"name="array">#</a>Array</h2><p><strong>List that can only hold numbers of a predefined type. Available types and their sizes in bytes are listed above.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> array <spanclass="hljs-keyword">import</span> array
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <collection>) <spanclass="hljs-comment"># Array from coll. of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <collection>) <spanclass="hljs-comment"># Array from collection of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <bytes>) <spanclass="hljs-comment"># Array from bytes object.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <array>) <spanclass="hljs-comment"># Treats array as a sequence of numbers.</span>
* Open `index.html` in text editor and first remove element `<p><br></p>` before the `<h1>Libraries</h1>`.
* Then replace the footer and last three `<br>` elements with contents of `pdf/index_for_pdf_print.html` file and save.
* Change all links in text to normal text. They can be found with this regex: `<strong>.*a href.*</strong>`.
* 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>`.
* Open `index.html` in Chrome.
* 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.
* Change lightness (L) percentage to:
@ -43,7 +43,7 @@ Adding headers and footers to PDF (the same for both files)
* In 'Change page size' section select 'A4' for 'Page Sizes' set 'XOffset' to '0.1 in' and select page range All.
* 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.
* 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.
* Set title and author by selecting 'File/Propertiess...'.
* Set title and author by selecting 'File/Properties...'.