8000 SQLite, Pygame · gto76/python-cheatsheet@9d967f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d967f5

Browse files
committed
SQLite, Pygame
1 parent 097a688 commit 9d967f5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,8 @@ with <conn>: # Exits the block with commit() o
19071907

19081908
### Placeholders
19091909
```python
1910-
<conn>.execute('<query>', <list/tuple>) # Replaces '?'s in query with values.
1911-
<conn>.execute('<query>', <dict/namedtuple>) # Replaces ':<key>'s with values.
1910+
<conn>.execute('<query>', <list/tuple>) # Replaces every question mark with an item.
1911+
<conn>.execute('<query>', <dict/namedtuple>) # Replaces every :<key> with value.
19121912
<conn>.executemany('<query>', <coll_of_coll>) # Runs execute() multiple times.
19131913
```
19141914
* **Passed values can be of type str, int, float, bytes, None, or bool (stored as 1 or 0).**
@@ -1931,7 +1931,7 @@ with <conn>: # Exits the block with commit() o
19311931
from sqlalchemy import create_engine, text
19321932
<engine> = create_engine('<url>') # Url: 'dialect://user:password@host/dbname'.
19331933
<conn> = <engine>.connect() # Creates a connection. Also <conn>.close().
1934-
<cursor> = <conn>.execute(text('<query>'), …) # `<dict>`. Replaces ':<key>'s with values.
1934+
<cursor> = <conn>.execute(text('<query>'), …) # `<dict>`. Replaces every :<key> with value.
19351935
with <conn>.begin(): ... # Exits the block with commit or rollback.
19361936
```
19371937

@@ -3048,7 +3048,7 @@ rect(<Surf>, color, <Rect>, width=0) # Also polygon(<Surf>, color, po
30483048

30493049
```python
30503050
<Font> = pg.font.Font(<path/file>, size) # Loads TTF file. Pass None for default font.
3051-
<Surf> = <Font>.render(text, antialias, color) # Background color can be specified at the end.
3051+
<Surf> = <Font>.render(text, antialias, color) # Accepts background color as fourth argument.
30523052
```
30533053

30543054
### Sound

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<body>
5858
<header>
59-
<aside>May 8, 2025</aside>
59+
<aside>May 9, 2025</aside>
6060
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
6161
</header>
6262

@@ -1591,8 +1591,8 @@
15911591
&lt;conn&gt;.execute(<span class="hljs-string">'&lt;query&gt;'</span>) <span class="hljs-comment"># depending on whether any exception occurred.</span>
15921592
</code></pre></div>
15931593

1594-
<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 '?'s in query with values.</span>
1595-
&lt;conn&gt;.execute(<span class="hljs-string">'&lt;query&gt;'</span>, &lt;dict/namedtuple&gt;) <span class="hljs-comment"># Replaces ':&lt;key&gt;'s with values.</span>
1594+
<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>
1595+
&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>
15961596
&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>
15971597
</code></pre></div>
15981598

@@ -1612,7 +1612,7 @@
16121612
<span class="hljs-keyword">from</span> sqlalchemy <span class="hljs-keyword">import</span> create_engine, text
16131613
&lt;engine&gt; = create_engine(<span class="hljs-string">'&lt;url&gt;'</span>) <span class="hljs-comment"># Url: 'dialect://user:password@host/dbname'.</span>
16141614
&lt;conn&gt; = &lt;engine&gt;.connect() <span class="hljs-comment"># Creates a connection. Also &lt;conn&gt;.close().</span>
1615-
&lt;cursor&gt; = &lt;conn&gt;.execute(text(<span class="hljs-string">'&lt;query&gt;'</span>), …) <span class="hljs-comment"># `&lt;dict&gt;`. Replaces ':&lt;key&gt;'s with values.</span>
1615+
&lt;cursor&gt; = &lt;conn&gt;.execute(text(<span class="hljs-string">'&lt;query&gt;'</span>), …) <span class="hljs-comment"># `&lt;dict&gt;`. Replaces every :&lt;key&gt; with value.</span>
16161616
<span class="hljs-keyword">with</span> &lt;conn&gt;.begin(): ... <span class="hljs-comment"># Exits the block with commit or rollback.</span>
16171617
</code></pre></div>
16181618

@@ -2496,7 +2496,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
24962496
rect(&lt;Surf&gt;, color, &lt;Rect&gt;, width=<span class="hljs-number">0</span>) <span class="hljs-comment"># Also polygon(&lt;Surf&gt;, color, points, width=0).</span>
24972497
</code></pre>
24982498
<pre><code class="python language-python hljs">&lt;Font&gt; = pg.font.Font(&lt;path/file&gt;, size) <span class="hljs-comment"># Loads TTF file. Pass None for default font.</span>
2499-
&lt;Surf&gt; = &lt;Font&gt;.render(text, antialias, color) <span class="hljs-comment"># Background color can be specified at the end.</span>
2499+
&lt;Surf&gt; = &lt;Font&gt;.render(text, antialias, color) <span class="hljs-comment"># Accepts background color as fourth argument.</span>
25002500
</code></pre>
25012501
<div><h3 id="sound">Sound</h3><pre><code class="python language-python hljs">&lt;Sound&gt; = pg.mixer.Sound(&lt;path/file/bytes&gt;) <span class="hljs-comment"># WAV file or bytes/array of signed shorts.</span>
25022502
&lt;Sound&gt;.play/stop() <span class="hljs-comment"># Also set_volume(&lt;float&gt;) and fadeout(msec).</span>
@@ -2940,7 +2940,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29402940

29412941

29422942
<footer>
2943-
<aside>May 8, 2025</aside>
2943+
<aside>May 9, 2025</aside>
29442944
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29452945
</footer>
29462946

0 commit comments

Comments
 (0)
0