<array>.fromfile(<file>, n_items) <spanclass="hljs-comment"># Appends items from the binary file.</span>
</code></pre>
<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 to the binary file.</span>
<file>.write(<array>) <spanclass="hljs-comment"># Writes array's memory to the file.</span>
</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, else mutable.</span>
<real> = <mview>[index] <spanclass="hljs-comment"># Returns an int or a float.</span>
<mview> = <mview>[<slice>] <spanclass="hljs-comment"># Returns mview with rearranged elements.</span>
<mview> = <mview>.cast(<spanclass="hljs-string">'<typecode>'</span>) <spanclass="hljs-comment"># Only works between b/B/c and other types.</span>
<mview> = <mview>.cast(<spanclass="hljs-string">'<typecode>'</span>) <spanclass="hljs-comment"># Only works between B/b/c and other types.</span>
<mview>.release() <spanclass="hljs-comment"># Releases memory buffer of the base object.</span>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<mview>) <spanclass="hljs-comment"># Returns a new bytes object.</span>
<bytes> = <bytes>.join(<coll_of_mviews>) <spanclass="hljs-comment"># Joins mviews using bytes as a separator.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <mview>) <spanclass="hljs-comment"># Treats mview as a sequence of numbers.</span>
<file>.write(<mview>) <spanclass="hljs-comment"># Writes mview to the binary file.</span>
<file>.write(<mview>) <spanclass="hljs-comment"># Writes `bytes(<mview>)` to the file.</span>
</code></pre>
<pre><codeclass="python language-python hljs"><list> = list(<mview>) <spanclass="hljs-comment"># Returns a list of ints or floats.</span>
<pre><codeclass="python language-python hljs"><list> = list(<mview>) <spanclass="hljs-comment"># Returns a list of ints, floats or bytes.</span>
<str> = str(<mview>, <spanclass="hljs-string">'utf-8'</span>) <spanclass="hljs-comment"># Treats mview as a bytes object.</span>