Skip to content

Commit ec86a0e

Browse files
committed
Command line arguments, CSV
1 parent 13062b2 commit ec86a0e

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,9 +1542,9 @@ args = p.parse_args() # Exits on err
15421542
value = args.<name>
15431543
```
15441544

1545-
* **Use `'help=<str>'` to set argument description.**
1545+
* **Use `'help=<str>'` to set argument description that will be displayed in help message.**
15461546
* **Use `'default=<el>'` to set the default value.**
1547-
* **Use `'type=FileType(<mode>)'` for files.**
1547+
* **Use `'type=FileType(<mode>)'` for files. Also accepts 'encoding', but not 'newline'.**
15481548

15491549

15501550
Open
@@ -1813,8 +1813,9 @@ import csv
18131813
<list> = next(<reader>) # Returns next row as a list of strings.
18141814
<list> = list(<reader>) # Returns a list of remaining rows.
18151815
```
1816-
* **For XML and binary Excel files (xlsx, xlsm and xlsb) use [Pandas](#dataframe-plot-encode-decode) library.**
18171816
* **File must be opened with a `'newline=""'` argument, or newlines embedded inside quoted fields will not be interpreted correctly!**
1817+
* **For XML and binary Excel files (xlsx, xlsm and xlsb) use [Pandas](#dataframe-plot-encode-decode) library.**
1818+
* **To print the table to console use [Tabulate](#table) library.**
18181819

18191820
### Write
18201821
```python
@@ -1830,7 +1831,7 @@ import csv
18301831
* **`'quotechar'` - Character for quoting fields that contain special characters.**
18311832
* **`'doublequote'` - Whether quotechars inside fields are/get doubled or escaped.**
18321833
* **`'skipinitialspace'` - Whether whitespace after delimiter gets stripped by reader.**
1833-
* **`'lineterminator'` - How writer terminates rows. Reader is hardcoded to '\r', '\n', '\r\n'.**
1834+
* **`'lineterminator'` - How writer terminates rows. Reader is hardcoded to '\n', '\r', '\r\n'.**
18341835
* **`'quoting'` - Controls the amount of quoting: 0 - as necessary, 1 - all.**
18351836
* **`'escapechar'` - Character for escaping quotechars if doublequote is False.**
18361837

@@ -2980,7 +2981,7 @@ while all(event.type != pg.QUIT for event in pg.event.get()):
29802981
<bool> = <Rect>.collidepoint((x, y)) # Checks if rectangle contains a point.
29812982
<bool> = <Rect>.colliderect(<Rect>) # Checks if two rectangles overlap.
29822983
<int> = <Rect>.collidelist(<list_of_Rect>) # Returns index of first colliding Rect or -1.
2983-
<list> = <Rect>.collidelistall(<list_of_Rect>) # Returns indexes of all colliding Rects.
2984+
<list> = <Rect>.collidelistall(<list_of_Rect>) # Returns indexes of all colliding rectangles.
29842985
```
29852986

29862987
### Surface

index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,9 +1319,9 @@
13191319
</code></pre></div>
13201320

13211321
<ul>
1322-
<li><strong>Use <code class="python hljs"><span class="hljs-string">'help=&lt;str&gt;'</span></code> to set argument description.</strong></li>
1322+
<li><strong>Use <code class="python hljs"><span class="hljs-string">'help=&lt;str&gt;'</span></code> to set argument description that will be displayed in help message.</strong></li>
13231323
<li><strong>Use <code class="python hljs"><span class="hljs-string">'default=&lt;el&gt;'</span></code> to set the default value.</strong></li>
1324-
<li><strong>Use <code class="python hljs"><span class="hljs-string">'type=FileType(&lt;mode&gt;)'</span></code> for files.</strong></li>
1324+
<li><strong>Use <code class="python hljs"><span class="hljs-string">'type=FileType(&lt;mode&gt;)'</span></code> for files. Also accepts 'encoding', but not 'newline'.</strong></li>
13251325
</ul>
13261326
<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">&lt;file&gt; = open(&lt;path&gt;, mode=<span class="hljs-string">'r'</span>, encoding=<span class="hljs-keyword">None</span>, newline=<span class="hljs-keyword">None</span>)
13271327
</code></pre></div>
@@ -1512,8 +1512,9 @@
15121512
</code></pre></div>
15131513

15141514
<ul>
1515-
<li><strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong></li>
15161515
<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>
15171518
</ul>
15181519
<div><h3 id="write">Write</h3><pre><code class="python language-python hljs">&lt;writer&gt; = csv.writer(&lt;file&gt;) <span class="hljs-comment"># Also: `dialect='excel', delimiter=','`.</span>
15191520
&lt;writer&gt;.writerow(&lt;collection&gt;) <span class="hljs-comment"># Encodes objects using `str(&lt;el&gt;)`.</span>
@@ -1529,7 +1530,7 @@
15291530
<li><strong><code class="python hljs"><span class="hljs-string">'quotechar'</span></code> - Character for quoting fields that contain special characters.</strong></li>
15301531
<li><strong><code class="python hljs"><span class="hljs-string">'doublequote'</span></code> - Whether quotechars inside fields are/get doubled or escaped.</strong></li>
15311532
<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>
15331534
<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>
15341535
<li><strong><code class="python hljs"><span class="hljs-string">'escapechar'</span></code> - Character for escaping quotechars if doublequote is False.</strong></li>
15351536
</ul><div><h3 id="dialects">Dialects</h3><pre><code class="text language-text">┏━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┓
@@ -2425,7 +2426,7 @@
24252426
<pre><code class="python language-python hljs">&lt;bool&gt; = &lt;Rect&gt;.collidepoint((x, y)) <span class="hljs-comment"># Checks if rectangle contains a point.</span>
24262427
&lt;bool&gt; = &lt;Rect&gt;.colliderect(&lt;Rect&gt;) <span class="hljs-comment"># Checks if two rectangles overlap.</span>
24272428
&lt;int&gt; = &lt;Rect&gt;.collidelist(&lt;list_of_Rect&gt;) <span class="hljs-comment"># Returns index of first colliding Rect or -1.</span>
2428-
&lt;list&gt; = &lt;Rect&gt;.collidelistall(&lt;list_of_Rect&gt;) <span class="hljs-comment"># Returns indexes of all colliding Rects.</span>
2429+
&lt;list&gt; = &lt;Rect&gt;.collidelistall(&lt;list_of_Rect&gt;) <span class="hljs-comment"># Returns indexes of all colliding rectangles.</span>
24292430
</code></pre>
24302431
<div><h3 id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><code class="python language-python hljs">&lt;Surf&gt; = pg.display.set_mode((width, height)) <span class="hljs-comment"># Returns display surface.</span>
24312432
&lt;Surf&gt; = pg.Surface((width, height), flags=<span class="hljs-number">0</span>) <span class="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>

pdf/remove_links.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'<strong>Generators returned by the <a href="#generator">generator functions</a> and <a href="#comprehensions">generator expressions</a>.</strong>': '<strong>Generators returned by the generator functions (p. 4) and generator expressions (p. 11).</strong>',
1818
'<strong>File objects returned by the <a href="#open">open()</a> function, etc.</strong>': '<strong>File objects returned by the open() function (p. 22), etc.</strong>',
1919
'<strong>Functions report OS related errors by raising either OSError or one of its <a href="#exceptions-1">subclasses</a>.</strong>': '<strong>Functions report OS related errors by raising OSError or one of its subclasses (p. 23).</strong>',
20+
'<strong>To print the table to console use <a href="#table">Tabulate</a> library.</strong>': '<strong>To print the table to console use Tabulate library (p. 34).</strong>',
2021
'<strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong>': '<strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use Pandas library (p. 46).</strong>',
2122
'<strong>Bools will be stored and returned as ints and dates as <a href="#encode">ISO formatted strings</a>.</strong>': '<strong>Bools will be stored and returned as ints and dates as ISO formatted strings (p. 9).</strong>',
2223
'<strong>An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. All arguments must be <a href="#pickle">pickable</a>.</strong>': '<strong>An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. All arguments must be pickable (p. 25).</strong>',

0 commit comments

Comments
 (0)