Skip to content

Commit 42f7b65

Browse files
committed
General fixes from Open until CSV
1 parent 474e5fb commit 42f7b65

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ Open
15501550
<file>.seek(0) # Moves to the start of the file.
15511551
<file>.seek(offset) # Moves 'offset' chars/bytes from the start.
15521552
<file>.seek(0, 2) # Moves to the end of the file.
1553-
<bin_file>.seek(±offset, <anchor>) # Anchor: 0 start, 1 current pos., 2 end.
1553+
<bin_file>.seek(±offset, <anchor>) # Anchor: 0 start, 1 current position, 2 end.
15541554
```
15551555

15561556
```python
@@ -1677,7 +1677,7 @@ os.mkdir(<path>, mode=0o777) # Creates a directory. Mode is in octal.
16771677
```
16781678

16791679
```python
1680-
shutil.copy(from, to) # Copies the file. 'to' can be a directory.
1680+
shutil.copy(from, to) # Copies the file. 'to' can exist or be a dir.
16811681
shutil.copytree(from, to) # Copies the directory. 'to' must not exist.
16821682
```
16831683

@@ -1698,14 +1698,14 @@ import os
16981698
<str> = os.popen('<shell_command>').read()
16991699
```
17001700

1701-
#### Sends '1 + 1' to the calculator and captures its output:
1701+
#### Sends '1 + 1' to the basic calculator and captures its output:
17021702
```python
17031703
>>> from subprocess import run
17041704
>>> run('bc', input='1 + 1\n', capture_output=True, encoding='utf-8')
17051705
CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='')
17061706
```
17071707

1708-
#### Sends test.in to the calculator running in standard mode and saves its output to test.out:
1708+
#### Sends test.in to the basic calculator running in standard mode and saves its output to test.out:
17091709
```python
17101710
>>> from shlex import split
17111711
>>> os.popen('echo 1 + 1 > test.in')
@@ -1788,7 +1788,7 @@ import csv
17881788
<writer>.writerow(<collection>) # Encodes objects using `str(<el>)`.
17891789
<writer>.writerows(<coll_of_coll>) # Appends multiple rows.
17901790
```
1791-
* **File must be opened with `'newline=""'` argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' line endings!**
1791+
* **File must be opened with `'newline=""'` argument, or '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings!**
17921792

17931793
### Parameters
17941794
* **`'dialect'` - Master parameter that sets the default values.**

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@
14371437
</ul><div><h3 id="fileobject">File Object</h3><pre><code class="python language-python hljs">&lt;file&gt;.seek(<span class="hljs-number">0</span>) <span class="hljs-comment"># Moves to the start of the file.</span>
14381438
&lt;file&gt;.seek(offset) <span class="hljs-comment"># Moves 'offset' chars/bytes from the start.</span>
14391439
&lt;file&gt;.seek(<span class="hljs-number">0</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Moves to the end of the file.</span>
1440-
&lt;bin_file&gt;.seek(±offset, &lt;anchor&gt;) <span class="hljs-comment"># Anchor: 0 start, 1 current pos., 2 end.</span>
1440+
&lt;bin_file&gt;.seek(±offset, &lt;anchor&gt;) <span class="hljs-comment"># Anchor: 0 start, 1 current position, 2 end.</span>
14411441
</code></pre></div></div></div>
14421442

14431443

@@ -1527,7 +1527,7 @@
15271527
<pre><code class="python language-python hljs">os.chdir(&lt;path&gt;) <span class="hljs-comment"># Changes the current working directory.</span>
15281528
os.mkdir(&lt;path&gt;, mode=<span class="hljs-number">0o777</span>) <span class="hljs-comment"># Creates a directory. Mode is in octal.</span>
15291529
</code></pre>
1530-
<pre><code class="python language-python hljs">shutil.copy(from, to) <span class="hljs-comment"># Copies the file. 'to' can be a directory.</span>
1530+
<pre><code class="python language-python hljs">shutil.copy(from, to) <span class="hljs-comment"># Copies the file. 'to' can exist or be a dir.</span>
15311531
shutil.copytree(from, to) <span class="hljs-comment"># Copies the directory. 'to' must not exist.</span>
15321532
</code></pre>
15331533
<pre><code class="python language-python hljs">os.rename(from, to) <span class="hljs-comment"># Renames/moves the file or directory.</span>
@@ -1541,12 +1541,12 @@
15411541
&lt;str&gt; = os.popen(<span class="hljs-string">'&lt;shell_command&gt;'</span>).read()
15421542
</code></pre></div>
15431543

1544-
<div><h4 id="sends11tothecalculatorandcapturesitsoutput">Sends '1 + 1' to the calculator and captures its output:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> subprocess <span class="hljs-keyword">import</span> run
1544+
<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><span class="hljs-keyword">from</span> subprocess <span class="hljs-keyword">import</span> run
15451545
<span class="hljs-meta">&gt;&gt;&gt; </span>run(<span class="hljs-string">'bc'</span>, input=<span class="hljs-string">'1 + 1\n'</span>, capture_output=<span class="hljs-keyword">True</span>, encoding=<span class="hljs-string">'utf-8'</span>)
15461546
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>)
15471547
</code></pre></div>
15481548

1549-
<div><h4 id="sendstestintothecalculatorrunninginstandardmodeandsavesitsoutputtotestout">Sends test.in to the calculator running in standard mode and saves its output to test.out:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> shlex <span class="hljs-keyword">import</span> split
1549+
<div><h4 id="sendstestintothebasiccalculatorrunninginstandardmodeandsavesitsoutputtotestout">Sends test.in to the basic calculator running in standard mode and saves its output to test.out:</h4><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> shlex <span class="hljs-keyword">import</span> split
15501550
<span class="hljs-meta">&gt;&gt;&gt; </span>os.popen(<span class="hljs-string">'echo 1 + 1 &gt; test.in'</span>)
15511551
<span class="hljs-meta">&gt;&gt;&gt; </span>run(split(<span class="hljs-string">'bc -s'</span>), stdin=open(<span class="hljs-string">'test.in'</span>), stdout=open(<span class="hljs-string">'test.out'</span>, <span class="hljs-string">'w'</span>))
15521552
CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-string">'-s'</span>], returncode=<span class="hljs-number">0</span>)
@@ -1604,7 +1604,7 @@
16041604
</code></pre></div>
16051605

16061606
<ul>
1607-
<li><strong>File must be opened with <code class="python hljs"><span class="hljs-string">'newline=""'</span></code> argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' line endings!</strong></li>
1607+
<li><strong>File must be opened with <code class="python hljs"><span class="hljs-string">'newline=""'</span></code> argument, or '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings!</strong></li>
16081608
</ul>
16091609
<div><h3 id="parameters">Parameters</h3><ul>
16101610
<li><strong><code class="python hljs"><span class="hljs-string">'dialect'</span></code> - Master parameter that sets the default values.</strong></li>

parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const OS_RENAME =
3535
'os.replace(from, to) <span class="hljs-comment"># Same, but overwrites \'to\' if it exists.</span>\n';
3636

3737
const SHUTIL_COPY =
38-
'shutil.copy(from, to) <span class="hljs-comment"># Copies the file. \'to\' can be a directory.</span>\n' +
38+
'shutil.copy(from, to) <span class="hljs-comment"># Copies the file. \'to\' can exist or be a dir.</span>\n' +
3939
'shutil.copytree(from, to) <span class="hljs-comment"># Copies the directory. \'to\' must not exist.</span>\n';
4040

4141
const EVAL =

0 commit comments

Comments
 (0)