Skip to content

Commit e8d514b

Browse files
committed
Array
1 parent 4214842 commit e8d514b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,15 +2046,15 @@ from array import array
20462046
```
20472047

20482048
```python
2049-
<array> = array('<typecode>', <coll_of_nums>) # Array from collection of numbers.
2050-
<array> = array('<typecode>', <bytes>) # Copies bytes to array's memory.
2051-
<array> = array('<typecode>', <array>) # Treats array as a sequence of numbers.
2052-
<array>.fromfile(<file>, n_items) # Appends items from the binary file.
2049+
<array> = array('<typecode>', <coll_of_nums>) # Creates array from collection of numbers.
2050+
<array> = array('<typecode>', <bytes>) # Writes passed bytes to array's memory.
2051+
<array> = array('<typecode>', <array>) # Treats passed array as a sequence of numbers.
2052+
<array>.fromfile(<file>, n_items) # Appends file's contents to array's memory.
20532053
```
20542054

20552055
```python
20562056
<bytes> = bytes(<array>) # Returns a copy of array's memory.
2057-
<file>.write(<array>) # Writes array's memory to binary file.
2057+
<file>.write(<array>) # Writes array's memory to the binary file.
20582058
```
20592059

20602060

index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<body>
5757
<header>
58-
<aside>November 23, 2024</aside>
58+
<aside>November 26, 2024</aside>
5959
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
6060
</header>
6161

@@ -1689,13 +1689,13 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
16891689
</code></pre></div>
16901690

16911691

1692-
<pre><code class="python language-python hljs">&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;coll_of_nums&gt;) <span class="hljs-comment"># Array from collection of numbers.</span>
1693-
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Copies bytes to array's memory.</span>
1694-
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;array&gt;) <span class="hljs-comment"># Treats array as a sequence of numbers.</span>
1695-
&lt;array&gt;.fromfile(&lt;file&gt;, n_items) <span class="hljs-comment"># Appends items from the binary file.</span>
1692+
<pre><code class="python language-python hljs">&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;coll_of_nums&gt;) <span class="hljs-comment"># Creates array from collection of numbers.</span>
1693+
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Writes passed bytes to array's memory.</span>
1694+
&lt;array&gt; = array(<span class="hljs-string">'&lt;typecode&gt;'</span>, &lt;array&gt;) <span class="hljs-comment"># Treats passed array as a sequence of numbers.</span>
1695+
&lt;array&gt;.fromfile(&lt;file&gt;, n_items) <span class="hljs-comment"># Appends file's contents to array's memory.</span>
16961696
</code></pre>
16971697
<pre><code class="python language-python hljs">&lt;bytes&gt; = bytes(&lt;array&gt;) <span class="hljs-comment"># Returns a copy of array's memory.</span>
1698-
&lt;file&gt;.write(&lt;array&gt;) <span class="hljs-comment"># Writes array's memory to binary file.</span>
1698+
&lt;file&gt;.write(&lt;array&gt;) <span class="hljs-comment"># Writes array's memory to the binary file.</span>
16991699
</code></pre>
17001700
<div><h2 id="memoryview"><a href="#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><code class="python language-python hljs">&lt;mview&gt; = memoryview(&lt;bytes/bytearray/array&gt;) <span class="hljs-comment"># Immutable if bytes is passed, else mutable.</span>
17011701
&lt;obj&gt; = &lt;mview&gt;[index] <span class="hljs-comment"># Returns int or float. Bytes if format is 'c'.</span>
@@ -2923,7 +2923,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29232923

29242924

29252925
<footer>
2926-
<aside>November 23, 2024</aside>
2926+
<aside>November 26, 2024</aside>
29272927
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29282928
</footer>
29292929

0 commit comments

Comments
 (0)