Skip to content

Commit 40c12e4

Browse files
committed
Struct
1 parent c3e6a0b commit 40c12e4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ shutil.rmtree(<path>) # Deletes the directory.
17411741
<int> = <pipe>.close() # Returns None if last command exited with returncode 0.
17421742
```
17431743

1744-
#### Sends '1 + 1' to the basic calculator and captures its output:
1744+
#### Sends "1 + 1" to the basic calculator and captures its output:
17451745
```python
17461746
>>> subprocess.run('bc', input='1 + 1\n', capture_output=True, text=True)
17471747
CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='')
@@ -1910,7 +1910,7 @@ with <conn>: # Exits the block with commit() o
19101910
### Placeholders
19111911
```python
19121912
<conn>.execute('<query>', <list/tuple>) # Replaces every question mark with an item.
1913-
<conn>.execute('<query>', <dict/namedtuple>) # Replaces every :<key> with value.
1913+
<conn>.execute('<query>', <dict/namedtuple>) # Replaces every :<key> with a value.
19141914
<conn>.executemany('<query>', <coll_of_coll>) # Runs execute() multiple times.
19151915
```
19161916
* **Passed values can be of type str, int, float, bytes, None, or bool (stored as 1 or 0).**
@@ -1999,8 +1999,8 @@ Struct
19991999
```python
20002000
from struct import pack, unpack
20012001

2002-
<bytes> = pack('<format>', <num_1> [, ...]) # Packs numbers according to format string.
2003-
<tuple> = unpack('<format>', <bytes>) # Use iter_unpack() to get iterator of tuples.
2002+
<bytes> = pack('<format>', <el_1> [, ...]) # Packs numbers according to format string.
2003+
<tuple> = unpack('<format>', <bytes>) # Use iter_unpack() to get iterator of tuples.
20042004
```
20052005

20062006
```python

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@
14731473
&lt;int&gt; = &lt;pipe&gt;.close() <span class="hljs-comment"># Returns None if last command exited with returncode 0.</span>
14741474
</code></pre></div>
14751475

1476-
<div><h4 id="sends11tothebasiccalculatorandcapturesitsoutput">Sends '1 + 1' to the basic calculator and captures its output:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>subprocess.run(<span class="hljs-string">'bc'</span>, input=<span class="hljs-string">'1 + 1\n'</span>, capture_output=<span class="hljs-keyword">True</span>, text=<span class="hljs-keyword">True</span>)
1476+
<div><h4 id="sends11tothebasiccalculatorandcapturesitsoutput">Sends "1 + 1" to the basic calculator and captures its output:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>subprocess.run(<span class="hljs-string">'bc'</span>, input=<span class="hljs-string">'1 + 1\n'</span>, capture_output=<span class="hljs-keyword">True</span>, text=<span class="hljs-keyword">True</span>)
14771477
CompletedProcess(args=<span class="hljs-string">'bc'</span>, returncode=<span class="hljs-number">0</span>, stdout=<span class="hljs-string">'2\n'</span>, stderr=<span class="hljs-string">''</span>)
14781478
</code></pre></div>
14791479

@@ -1597,7 +1597,7 @@
15971597
</code></pre></div>
15981598

15991599
<div><h3 id="placeholders">Placeholders</h3><pre><code class="python language-python hljs">&lt;conn&gt;.execute(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;list/tuple&gt;) <span class="hljs-comment"># Replaces every question mark with an item.</span>
1600-
&lt;conn&gt;.execute(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;dict/namedtuple&gt;) <span class="hljs-comment"># Replaces every :&lt;key&gt; with value.</span>
1600+
&lt;conn&gt;.execute(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;dict/namedtuple&gt;) <span class="hljs-comment"># Replaces every :&lt;key&gt; with a value.</span>
16011601
&lt;conn&gt;.executemany(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;coll_of_coll&gt;) <span class="hljs-comment"># Runs execute() multiple times.</span>
16021602
</code></pre></div>
16031603

@@ -1665,8 +1665,8 @@
16651665
<li><strong>System’s type sizes, byte order, and alignment rules are used by default.</strong></li>
16661666
</ul><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> struct <span class="hljs-keyword">import</span> pack, unpack
16671667

1668-
&lt;bytes&gt; = pack(<span class="hljs-string">'&lt;format&gt;'</span>, &lt;num_1&gt; [, ...]) <span class="hljs-comment"># Packs numbers according to format string.</span>
1669-
&lt;tuple&gt; = unpack(<span class="hljs-string">'&lt;format&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Use iter_unpack() to get iterator of tuples.</span>
1668+
&lt;bytes&gt; = pack(<span class="hljs-string">'&lt;format&gt;'</span>, &lt;el_1&gt; [, ...]) <span class="hljs-comment"># Packs numbers according to format string.</span>
1669+
&lt;tuple&gt; = unpack(<span class="hljs-string">'&lt;format&gt;'</span>, &lt;bytes&gt;) <span class="hljs-comment"># Use iter_unpack() to get iterator of tuples.</span>
16701670
</code></pre></div>
16711671

16721672

0 commit comments

Comments
 (0)