Skip to content

Commit 4159345

Browse files
committed
Bytes
1 parent aa46f3c commit 4159345

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
@@ -1912,15 +1912,15 @@ Bytes
19121912
```python
19131913
<bytes> = bytes(<coll_of_ints>) # Ints must be in range from 0 to 255.
19141914
<bytes> = bytes(<str>, 'utf-8') # Or: <str>.encode('utf-8')
1915-
<bytes> = <int>.to_bytes(n_bytes) # Also: `byteorder='big/little', signed=False`.
1915+
<bytes> = <int>.to_bytes(n_bytes, …) # `byteorder='big/little', signed=False`
19161916
<bytes> = bytes.fromhex('<hex>') # Hex numbers can be separated by spaces.
19171917
```
19181918

19191919
### Decode
19201920
```python
19211921
<list> = list(<bytes>) # Returns ints in range from 0 to 255.
19221922
<str> = str(<bytes>, 'utf-8') # Or: <bytes>.decode('utf-8')
1923-
<int> = int.from_bytes(<bytes>) # Also: `byteorder='big/little', signed=False`.
1923+
<int> = int.from_bytes(<bytes>, …) # `byteorder='big/little', signed=False`
19241924
'<hex>' = <bytes>.hex() # Returns a string of hexadecimal numbers.
19251925
```
19261926

@@ -2016,7 +2016,7 @@ Memory View
20162016
```python
20172017
<list> = list(<mview>) # Returns list of ints or floats.
20182018
<str> = str(<mview>, 'utf-8') # Treats mview as a bytes object.
2019-
<int> = int.from_bytes(<mview>, …) # `byteorder='big/little', signed=False`.
2019+
<int> = int.from_bytes(<mview>, …) # `byteorder='big/little', signed=False`
20202020
'<hex>' = <mview>.hex() # Treats mview as a bytes object.
20212021
```
20222022

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,13 +1701,13 @@
17011701

17021702
<div><h3 id="encode-1">Encode</h3><pre><code class="python language-python hljs">&lt;bytes&gt; = bytes(&lt;coll_of_ints&gt;) <span class="hljs-comment"># Ints must be in range from 0 to 255.</span>
17031703
&lt;bytes&gt; = bytes(&lt;str&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: &lt;str&gt;.encode('utf-8')</span>
1704-
&lt;bytes&gt; = &lt;int&gt;.to_bytes(n_bytes) <span class="hljs-comment"># Also: `byteorder='big/little', signed=False`.</span>
1704+
&lt;bytes&gt; = &lt;int&gt;.to_bytes(n_bytes, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`</span>
17051705
&lt;bytes&gt; = bytes.fromhex(<span class="hljs-string">'&lt;hex&gt;'</span>) <span class="hljs-comment"># Hex numbers can be separated by spaces.</span>
17061706
</code></pre></div>
17071707

17081708
<div><h3 id="decode-1">Decode</h3><pre><code class="python language-python hljs">&lt;list&gt; = list(&lt;bytes&gt;) <span class="hljs-comment"># Returns ints in range from 0 to 255.</span>
17091709
&lt;str&gt; = str(&lt;bytes&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: &lt;bytes&gt;.decode('utf-8')</span>
1710-
&lt;int&gt; = int.from_bytes(&lt;bytes&gt;) <span class="hljs-comment"># Also: `byteorder='big/little', signed=False`.</span>
1710+
&lt;int&gt; = int.from_bytes(&lt;bytes&gt;, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`</span>
17111711
<span class="hljs-string">'&lt;hex&gt;'</span> = &lt;bytes&gt;.hex() <span class="hljs-comment"># Returns a string of hexadecimal numbers.</span>
17121712
</code></pre></div>
17131713

@@ -1786,7 +1786,7 @@
17861786

17871787
<pre><code class="python language-python hljs">&lt;list&gt; = list(&lt;mview&gt;) <span class="hljs-comment"># Returns list of ints or floats.</span>
17881788
&lt;str&gt; = str(&lt;mview&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Treats mview as a bytes object.</span>
1789-
&lt;int&gt; = int.from_bytes(&lt;mview&gt;, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`.</span>
1789+
&lt;int&gt; = int.from_bytes(&lt;mview&gt;, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`</span>
17901790
<span class="hljs-string">'&lt;hex&gt;'</span> = &lt;mview&gt;.hex() <span class="hljs-comment"># Treats mview as a bytes object.</span>
17911791
</code></pre>
17921792
<div><h2 id="deque"><a href="#deque" name="deque">#</a>Deque</h2><p><strong>A thread-safe list with efficient appends and pops from either side. Pronounced "deck".</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> deque

0 commit comments

Comments
 (0)