<div><h2id="bytes"><ahref="#bytes"name="bytes">#</a>Bytes</h2><p><strong>Bytes object is an immutable sequence of single bytes. Mutable version is called bytearray.</strong></p><pre><codeclass="python language-python hljs"><bytes> = <spanclass="hljs-string">b'<str>'</span><spanclass="hljs-comment"># Only accepts ASCII characters and \x00-\xff.</span>
<int> = <bytes>[<index>] <spanclass="hljs-comment"># Returns int in range from 0 to 255.</span>
<int> = <bytes>[<index>] <spanclass="hljs-comment"># Returns an int in range from 0 to 255.</span>
<bytes> = <bytes>[<slice>] <spanclass="hljs-comment"># Returns bytes even if it has only one element.</span>
<bytes> = <bytes>.join(<coll_of_bytes>) <spanclass="hljs-comment"># Joins elements using bytes as a separator.</span>