Browse Source

Memoryview

pull/46/head
Jure Šorn 4 years ago
parent
commit
f36d1a9094
2 changed files with 3 additions and 3 deletions
  1. 2
      README.md
  2. 4
      index.html

2
README.md

@ -1974,12 +1974,12 @@ Memory View
<real> = <mview>[<index>] # Returns an int or a float.
<mview> = <mview>[<slice>] # Mview with rearranged elements.
<mview> = <mview>.cast('<typecode>') # Casts memoryview to the new format.
<bin_file>.write(<mview>) # Appends mview to the binary file.
<mview>.release() # Releases the object's memory buffer.
```
### Decode
```python
<bin_file>.write(<mview>) # Appends mview to the binary file.
<bytes> = bytes(<mview>) # Creates a new bytes object.
<bytes> = <bytes>.join(<coll_of_mviews>) # Joins mviews using bytes object as sep.
<list> = list(<mview>) # Returns list of ints or floats.

4
index.html

@ -1746,12 +1746,12 @@ db = connector.connect(host=&lt;str&gt;, user=&lt;str&gt;, password=&lt;str&gt;,
&lt;real&gt; = &lt;mview&gt;[&lt;index&gt;] <span class="hljs-comment"># Returns an int or a float.</span>
&lt;mview&gt; = &lt;mview&gt;[&lt;slice&gt;] <span class="hljs-comment"># Mview with rearranged elements.</span>
&lt;mview&gt; = &lt;mview&gt;.cast(<span class="hljs-string">'&lt;typecode&gt;'</span>) <span class="hljs-comment"># Casts memoryview to the new format.</span>
&lt;bin_file&gt;.write(&lt;mview&gt;) <span class="hljs-comment"># Appends mview to the binary file.</span>
&lt;mview&gt;.release() <span class="hljs-comment"># Releases the object's memory buffer.</span>
</code></pre></div>
<div><h3 id="decode-2">Decode</h3><pre><code class="python language-python hljs">&lt;bytes&gt; = bytes(&lt;mview&gt;) <span class="hljs-comment"># Creates a new bytes object.</span>
<div><h3 id="decode-2">Decode</h3><pre><code class="python language-python hljs">&lt;bin_file&gt;.write(&lt;mview&gt;) <span class="hljs-comment"># Appends mview to the binary file.</span>
&lt;bytes&gt; = bytes(&lt;mview&gt;) <span class="hljs-comment"># Creates a new bytes object.</span>
&lt;bytes&gt; = &lt;bytes&gt;.join(&lt;coll_of_mviews&gt;) <span class="hljs-comment"># Joins mviews using bytes object as sep.</span>
&lt;list&gt; = list(&lt;mview&gt;) <span class="hljs-comment"># Returns list of ints or floats.</span>
&lt;str&gt; = str(&lt;mview&gt;, <span class="hljs-string">'utf-8'</span>)

Loading…
Cancel
Save