Skip to content

Commit ca83f4e

Browse files
committed
Bytes
1 parent 95f59d2 commit ca83f4e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,15 +1914,15 @@ Bytes
19141914
<bytes> = bytes(<coll_of_ints>) # Ints must be in range from 0 to 255.
19151915
<bytes> = bytes(<str>, 'utf-8') # Or: <str>.encode('utf-8')
19161916
<bytes> = <int>.to_bytes(n_bytes, …) # `byteorder='big/little', signed=False`.
1917-
<bytes> = bytes.fromhex('<hex>') # Hex numbers can be separated by spaces.
1917+
<bytes> = bytes.fromhex('<hex>') # Hex pairs can be separated by spaces.
19181918
```
19191919

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

19281928
### Read Bytes from File

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,13 +1715,13 @@
17151715
<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>
17161716
&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>
17171717
&lt;bytes&gt; = &lt;int&gt;.to_bytes(n_bytes, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`.</span>
1718-
&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>
1718+
&lt;bytes&gt; = bytes.fromhex(<span class="hljs-string">'&lt;hex&gt;'</span>) <span class="hljs-comment"># Hex pairs can be separated by spaces.</span>
17191719
</code></pre></div>
17201720

17211721
<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>
17221722
&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>
17231723
&lt;int&gt; = int.from_bytes(&lt;bytes&gt;, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`.</span>
1724-
<span class="hljs-string">'&lt;hex&gt;'</span> = &lt;bytes&gt;.hex() <span class="hljs-comment"># Returns a string of hexadecimal numbers.</span>
1724+
<span class="hljs-string">'&lt;hex&gt;'</span> = &lt;bytes&gt;.hex() <span class="hljs-comment"># Returns a string of hexadecimal pairs.</span>
17251725
</code></pre></div>
17261726

17271727
<div><h3 id="readbytesfromfile">Read Bytes from File</h3><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">read_bytes</span><span class="hljs-params">(filename)</span>:</span>

0 commit comments

Comments
 (0)