<pre><codeclass="python language-python hljs"><array> = array(<spanclass="hljs-string">'<typecode>'</span>, <coll_of_nums>) <spanclass="hljs-comment"># Array from collection of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <bytes>) <spanclass="hljs-comment"># Copies bytes to array's memory.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <array>) <spanclass="hljs-comment"># Treats array as a sequence of numbers.</span>
<array>.fromfile(<file>, n_items) <spanclass="hljs-comment"># Appends items from the binary file.</span>
<pre><codeclass="python language-python hljs"><array> = array(<spanclass="hljs-string">'<typecode>'</span>, <coll_of_nums>) <spanclass="hljs-comment"># Creates array from collection of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <array>) <spanclass="hljs-comment"># Treats passed array as a sequence of numbers.</span>
<array>.fromfile(<file>, n_items) <spanclass="hljs-comment"># Appends file's contents to array's memory.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<array>) <spanclass="hljs-comment"># Returns a copy of array's memory.</span>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<array>) <spanclass="hljs-comment"># Returns a copy of array's memory.</span>
<file>.write(<array>) <spanclass="hljs-comment"># Writes array's memory to binary file.</span>
<file>.write(<array>) <spanclass="hljs-comment"># Writes array's memory to the binary file.</span>
</code></pre>
</code></pre>
<div><h2id="memoryview"><ahref="#memoryview"name="memoryview">#</a>Memory View</h2><p><strong>A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.</strong></p><pre><codeclass="python language-python hljs"><mview> = memoryview(<bytes/bytearray/array>) <spanclass="hljs-comment"># Immutable if bytes is passed, else mutable.</span>
<div><h2id="memoryview"><ahref="#memoryview"name="memoryview">#</a>Memory View</h2><p><strong>A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.</strong></p><pre><codeclass="python language-python hljs"><mview> = memoryview(<bytes/bytearray/array>) <spanclass="hljs-comment"># Immutable if bytes is passed, else mutable.</span>
<obj> = <mview>[index] <spanclass="hljs-comment"># Returns int or float. Bytes if format is 'c'.</span>
<obj> = <mview>[index] <spanclass="hljs-comment"># Returns int or float. Bytes if format is 'c'.</span>
@ -2923,7 +2923,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active