Browse Source

Typos

pull/44/head
Jure Šorn 5 years ago
parent
commit
c5bfdb03a4
2 changed files with 18 additions and 18 deletions
  1. 18
      README.md
  2. 18
      index.html

18
README.md

@ -1943,22 +1943,22 @@ Array
```python
from array import array
<array> = array('<typecode>', <collection>) # Array from coll. of numbers.
<array> = array('<typecode>', <bytes>) # Array from bytes object.
<array> = array('<typecode>', <collection>) # Array from coll. of numbers.
<array> = array('<typecode>', <bytes>) # Array from bytes object.
<bytes> = <array>.tobytes()
```
Memory View
-----------
* **A seqence object that points to the memory of another object.**
* **A sequence object that points to the memory of another object.**
* **Each element can reference a single or multiple consecutive bytes, depending on format.**
* **Order and number of elements can be changed with slicing.**
```python
<mview> = memoryview(<bytes/bytearray/array>)
<num> = <mview>[<index>] # Can be int or float.
<mview> = <mview>[<slice>] # Mview with rearanged elements.
<mview> = <mview>[<slice>] # Mview with rearranged elements.
<mview> = <mview>.cast('<typecode>') # Casts a memoryview to a new format.
<mview>.release() # Releases the object's memory buffer.
```
@ -1984,10 +1984,10 @@ from collections import deque
```
```python
<deque>.appendleft(<el>) # Opposite element is dropped if full.
<el> = <deque>.popleft() # Raises IndexError if empty.
<deque>.extendleft(<collection>) # Collection gets reversed.
<deque>.rotate(n=1) # Rotates elements to the right.
<deque>.appendleft(<el>) # Opposite element is dropped if full.
<el> = <deque>.popleft() # Raises IndexError if empty.
<deque>.extendleft(<collection>) # Collection gets reversed.
<deque>.rotate(n=1) # Rotates elements to the right.
```
@ -2286,7 +2286,7 @@ with open('test.csv', encoding='utf-8', newline='') as file:
Curses
------
#### Clears terminal, prints message and waits for ESC key press:
#### Clears the terminal, prints a message and waits for an ESC key press:
```python
from curses import wrapper, curs_set, ascii
from curses import KEY_UP, KEY_RIGHT, KEY_DOWN, KEY_LEFT

18
index.html

@ -1723,19 +1723,19 @@ db = connector.connect(host=&lt;str&gt;, user=&lt;str&gt;, password=&lt;str&gt;,
<div><h2 id="array"><a href="#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><code class="python language-python hljs"><span class="hljs-keyword">from</span> array <span class="hljs-keyword">import</span> array
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;collection&gt;) <span class="hljs-comment"># Array from coll. of numbers.</span>
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Array from bytes object.</span>
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;collection&gt;) <span class="hljs-comment"># Array from coll. of numbers.</span>
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Array from bytes object.</span>
&lt;bytes&gt; = &lt;array&gt;.tobytes()
</code></pre></div>
<div><h2 id="memoryview"><a href="#memoryview" name="memoryview">#</a>Memory View</h2><ul>
<li><strong>A seqence object that points to the memory of another object.</strong></li>
<li><strong>A sequence object that points to the memory of another object.</strong></li>
<li><strong>Each element can reference a single or multiple consecutive bytes, depending on format.</strong></li>
<li><strong>Order and number of elements can be changed with slicing.</strong></li>
</ul><pre><code class="python language-python hljs">&lt;mview&gt; = memoryview(&lt;bytes/bytearray/array&gt;)
&lt;num&gt; = &lt;mview&gt;[&lt;index&gt;] <span class="hljs-comment"># Can be int or float.</span>
&lt;mview&gt; = &lt;mview&gt;[&lt;slice&gt;] <span class="hljs-comment"># Mview with rearanged elements.</span>
&lt;mview&gt; = &lt;mview&gt;[&lt;slice&gt;] <span class="hljs-comment"># Mview with rearranged elements.</span>
&lt;mview&gt; = &lt;mview&gt;.cast(<span class="hljs-string">'&lt;typecode&gt;'</span>) <span class="hljs-comment"># Casts a memoryview to a new format.</span>
&lt;mview&gt;.release() <span class="hljs-comment"># Releases the object's memory buffer.</span>
</code></pre></div>
@ -1754,10 +1754,10 @@ db = connector.connect(host=&lt;str&gt;, user=&lt;str&gt;, password=&lt;str&gt;,
</code></pre></div>
<pre><code class="python language-python hljs">&lt;deque&gt;.appendleft(&lt;el&gt;) <span class="hljs-comment"># Opposite element is dropped if full.</span>
&lt;el&gt; = &lt;deque&gt;.popleft() <span class="hljs-comment"># Raises IndexError if empty.</span>
&lt;deque&gt;.extendleft(&lt;collection&gt;) <span class="hljs-comment"># Collection gets reversed.</span>
&lt;deque&gt;.rotate(n=<span class="hljs-number">1</span>) <span class="hljs-comment"># Rotates elements to the right.</span>
<pre><code class="python language-python hljs">&lt;deque&gt;.appendleft(&lt;el&gt;) <span class="hljs-comment"># Opposite element is dropped if full.</span>
&lt;el&gt; = &lt;deque&gt;.popleft() <span class="hljs-comment"># Raises IndexError if empty.</span>
&lt;deque&gt;.extendleft(&lt;collection&gt;) <span class="hljs-comment"># Collection gets reversed.</span>
&lt;deque&gt;.rotate(n=<span class="hljs-number">1</span>) <span class="hljs-comment"># Rotates elements to the right.</span>
</code></pre>
<div><h2 id="threading"><a href="#threading" name="threading">#</a>Threading</h2><ul>
<li><strong>CPython interpreter can only run a single thread at a time.</strong></li>
@ -1974,7 +1974,7 @@ pyplot.clf() <span class="hljs-comment"># Clears figur
</code></pre></div></div>
<div><h2 id="curses"><a href="#curses" name="curses">#</a>Curses</h2><div><h4 id="clearsterminalprintsmessageandwaitsforesckeypress">Clears terminal, prints message and waits for ESC key press:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> curses <span class="hljs-keyword">import</span> wrapper, curs_set, ascii
<div><h2 id="curses"><a href="#curses" name="curses">#</a>Curses</h2><div><h4 id="clearstheterminalprintsamessageandwaitsforanesckeypress">Clears the terminal, prints a message and waits for an ESC key press:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> curses <span class="hljs-keyword">import</span> wrapper, curs_set, ascii
<span class="hljs-keyword">from</span> curses <span class="hljs-keyword">import</span> KEY_UP, KEY_RIGHT, KEY_DOWN, KEY_LEFT
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>:</span>

Loading…
Cancel
Save