|
1319 | 1319 | </code></pre></div>
|
1320 | 1320 |
|
1321 | 1321 | <ul>
|
1322 |
| -<li><strong>Use <code class="python hljs"><span class="hljs-string">'help=<str>'</span></code> to set argument description.</strong></li> |
| 1322 | +<li><strong>Use <code class="python hljs"><span class="hljs-string">'help=<str>'</span></code> to set argument description that will be displayed in help message.</strong></li> |
1323 | 1323 | <li><strong>Use <code class="python hljs"><span class="hljs-string">'default=<el>'</span></code> to set the default value.</strong></li>
|
1324 |
| -<li><strong>Use <code class="python hljs"><span class="hljs-string">'type=FileType(<mode>)'</span></code> for files.</strong></li> |
| 1324 | +<li><strong>Use <code class="python hljs"><span class="hljs-string">'type=FileType(<mode>)'</span></code> for files. Also accepts 'encoding', but not 'newline'.</strong></li> |
1325 | 1325 | </ul>
|
1326 | 1326 | <div><h2 id="open"><a href="#open" name="open">#</a>Open</h2><p><strong>Opens the file and returns a corresponding file object.</strong></p><pre><code class="python language-python hljs"><file> = open(<path>, mode=<span class="hljs-string">'r'</span>, encoding=<span class="hljs-keyword">None</span>, newline=<span class="hljs-keyword">None</span>)
|
1327 | 1327 | </code></pre></div>
|
|
1512 | 1512 | </code></pre></div>
|
1513 | 1513 |
|
1514 | 1514 | <ul>
|
1515 |
| -<li><strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong></li> |
1516 | 1515 | <li><strong>File must be opened with a <code class="python hljs"><span class="hljs-string">'newline=""'</span></code> argument, or newlines embedded inside quoted fields will not be interpreted correctly!</strong></li>
|
| 1516 | +<li><strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong></li> |
| 1517 | +<li><strong>To print the table to console use <a href="#table">Tabulate</a> library.</strong></li> |
1517 | 1518 | </ul>
|
1518 | 1519 | <div><h3 id="write">Write</h3><pre><code class="python language-python hljs"><writer> = csv.writer(<file>) <span class="hljs-comment"># Also: `dialect='excel', delimiter=','`.</span>
|
1519 | 1520 | <writer>.writerow(<collection>) <span class="hljs-comment"># Encodes objects using `str(<el>)`.</span>
|
|
1529 | 1530 | <li><strong><code class="python hljs"><span class="hljs-string">'quotechar'</span></code> - Character for quoting fields that contain special characters.</strong></li>
|
1530 | 1531 | <li><strong><code class="python hljs"><span class="hljs-string">'doublequote'</span></code> - Whether quotechars inside fields are/get doubled or escaped.</strong></li>
|
1531 | 1532 | <li><strong><code class="python hljs"><span class="hljs-string">'skipinitialspace'</span></code> - Whether whitespace after delimiter gets stripped by reader.</strong></li>
|
1532 |
| -<li><strong><code class="python hljs"><span class="hljs-string">'lineterminator'</span></code> - How writer terminates rows. Reader is hardcoded to '\r', '\n', '\r\n'.</strong></li> |
| 1533 | +<li><strong><code class="python hljs"><span class="hljs-string">'lineterminator'</span></code> - How writer terminates rows. Reader is hardcoded to '\n', '\r', '\r\n'.</strong></li> |
1533 | 1534 | <li><strong><code class="python hljs"><span class="hljs-string">'quoting'</span></code> - Controls the amount of quoting: 0 - as necessary, 1 - all.</strong></li>
|
1534 | 1535 | <li><strong><code class="python hljs"><span class="hljs-string">'escapechar'</span></code> - Character for escaping quotechars if doublequote is False.</strong></li>
|
1535 | 1536 | </ul><div><h3 id="dialects">Dialects</h3><pre><code class="text language-text">┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
|
|
2425 | 2426 | <pre><code class="python language-python hljs"><bool> = <Rect>.collidepoint((x, y)) <span class="hljs-comment"># Checks if rectangle contains a point.</span>
|
2426 | 2427 | <bool> = <Rect>.colliderect(<Rect>) <span class="hljs-comment"># Checks if two rectangles overlap.</span>
|
2427 | 2428 | <int> = <Rect>.collidelist(<list_of_Rect>) <span class="hljs-comment"># Returns index of first colliding Rect or -1.</span>
|
2428 |
| -<list> = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-comment"># Returns indexes of all colliding Rects.</span> |
| 2429 | +<list> = <Rect>.collidelistall(<list_of_Rect>) <span class="hljs-comment"># Returns indexes of all colliding rectangles.</span> |
2429 | 2430 | </code></pre>
|
2430 | 2431 | <div><h3 id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><code class="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <span class="hljs-comment"># Returns display surface.</span>
|
2431 | 2432 | <Surf> = pg.Surface((width, height), flags=<span class="hljs-number">0</span>) <span class="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
|
|
0 commit comments