diff --git a/README.md b/README.md index a516d8b..703a4c1 100644 --- a/README.md +++ b/README.md @@ -1861,7 +1861,7 @@ Bytes ### Encode ```python -<bytes> = <str>.encode('utf-8') # Or: bytes(<str>, 'utf-8') +<bytes> = bytes(<str>, 'utf-8') # Or: <str>.encode('utf-8') <bytes> = bytes(<coll_of_ints>) # Ints must be in range from 0 to 255. <bytes> = <int>.to_bytes(n_bytes, byteorder='big|little', signed=False) <bytes> = bytes.fromhex('<hex>') @@ -1869,7 +1869,7 @@ Bytes ### Decode ```python -<str> = <bytes>.decode('utf-8') # Or: str(<bytes>, 'utf-8') +<str> = str(<bytes>, 'utf-8') # Or: <bytes>.decode('utf-8') <list> = list(<bytes>) # Returns ints in range from 0 to 255. <int> = int.from_bytes(<bytes>, byteorder='big|little', signed=False) '<hex>' = <bytes>.hex() diff --git a/index.html b/index.html index d1484b0..7b57028 100644 --- a/index.html +++ b/index.html @@ -1658,13 +1658,13 @@ db = connector.connect(host=<str>, user=<str>, password=<str>, </code></pre></div> -<div><h3 id="encode-1">Encode</h3><pre><code class="python language-python hljs"><bytes> = <str>.encode(<span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: bytes(<str>, 'utf-8')</span> +<div><h3 id="encode-1">Encode</h3><pre><code class="python language-python hljs"><bytes> = bytes(<str>, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: <str>.encode('utf-8')</span> <bytes> = bytes(<coll_of_ints>) <span class="hljs-comment"># Ints must be in range from 0 to 255.</span> <bytes> = <int>.to_bytes(n_bytes, byteorder=<span class="hljs-string">'big|little'</span>, signed=<span class="hljs-keyword">False</span>) <bytes> = bytes.fromhex(<span class="hljs-string">'<hex>'</span>) </code></pre></div> -<div><h3 id="decode-1">Decode</h3><pre><code class="python language-python hljs"><str> = <bytes>.decode(<span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: str(<bytes>, 'utf-8')</span> +<div><h3 id="decode-1">Decode</h3><pre><code class="python language-python hljs"><str> = str(<bytes>, <span class="hljs-string">'utf-8'</span>) <span class="hljs-comment"># Or: <bytes>.decode('utf-8')</span> <list> = list(<bytes>) <span class="hljs-comment"># Returns ints in range from 0 to 255.</span> <int> = int.from_bytes(<bytes>, byteorder=<span class="hljs-string">'big|little'</span>, signed=<span class="hljs-keyword">False</span>) <span class="hljs-string">'<hex>'</span> = <bytes>.hex()