Skip to content

Commit 75e960c

Browse files
committed
Bytes
1 parent 2f3c94b commit 75e960c

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
@@ -1963,15 +1963,15 @@ Bytes
19631963
### Encode
19641964
```python
19651965
<bytes> = bytes(<coll_of_ints>) # Ints must be in range from 0 to 255.
1966-
<bytes> = bytes(<str>, 'utf-8') # Encodes string. Also <str>.encode('utf-8').
1966+
<bytes> = bytes(<str>, 'utf-8') # Encodes the string. Also <str>.encode().
19671967
<bytes> = bytes.fromhex('<hex>') # Hex pairs can be separated by whitespaces.
19681968
<bytes> = <int>.to_bytes(n_bytes, …) # `byteorder='big/little', signed=False`.
19691969
```
19701970

19711971
### Decode
19721972
```python
19731973
<list> = list(<bytes>) # Returns ints in range from 0 to 255.
1974-
<str> = str(<bytes>, 'utf-8') # Decodes bytes. Also <bytes>.decode('utf-8').
1974+
<str> = str(<bytes>, 'utf-8') # Returns a string. Also <bytes>.decode().
19751975
<str> = <bytes>.hex() # Returns hex pairs. Accepts `sep=<str>`.
19761976
<int> = int.from_bytes(<bytes>, …) # `byteorder='big/little', signed=False`.
19771977
```

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,13 +1623,13 @@
16231623

16241624

16251625
<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>
1626-
&lt;bytes&gt; = bytes(&lt;str&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Encodes string. Also &lt;str&gt;.encode('utf-8').</span>
1626+
&lt;bytes&gt; = bytes(&lt;str&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Encodes the string. Also &lt;str&gt;.encode().</span>
16271627
&lt;bytes&gt; = bytes.fromhex(<span class="hljs-string">'&lt;hex&gt;'</span>) <span class="hljs-comment"># Hex pairs can be separated by whitespaces.</span>
16281628
&lt;bytes&gt; = &lt;int&gt;.to_bytes(n_bytes, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`.</span>
16291629
</code></pre></div>
16301630

16311631
<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>
1632-
&lt;str&gt; = str(&lt;bytes&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Decodes bytes. Also &lt;bytes&gt;.decode('utf-8').</span>
1632+
&lt;str&gt; = str(&lt;bytes&gt;, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Returns a string. Also &lt;bytes&gt;.decode().</span>
16331633
&lt;str&gt; = &lt;bytes&gt;.hex() <span class="hljs-comment"># Returns hex pairs. Accepts `sep=&lt;str&gt;`.</span>
16341634
&lt;int&gt; = int.from_bytes(&lt;bytes&gt;, …) <span class="hljs-comment"># `byteorder='big/little', signed=False`.</span>
16351635
</code></pre></div>

0 commit comments

Comments
 (0)