From 42f7b6513869c0375c71cf754fa1fb43cdb367a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 19 Apr 2020 22:21:20 +0200 Subject: [PATCH] General fixes from Open until CSV --- README.md | 10 +++++----- index.html | 10 +++++----- parse.js | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 018c970..86210f3 100644 --- a/README.md +++ b/README.md @@ -1550,7 +1550,7 @@ Open .seek(0) # Moves to the start of the file. .seek(offset) # Moves 'offset' chars/bytes from the start. .seek(0, 2) # Moves to the end of the file. -.seek(±offset, ) # Anchor: 0 start, 1 current pos., 2 end. +.seek(±offset, ) # Anchor: 0 start, 1 current position, 2 end. ``` ```python @@ -1677,7 +1677,7 @@ os.mkdir(, mode=0o777) # Creates a directory. Mode is in octal. ``` ```python -shutil.copy(from, to) # Copies the file. 'to' can be a directory. +shutil.copy(from, to) # Copies the file. 'to' can exist or be a dir. shutil.copytree(from, to) # Copies the directory. 'to' must not exist. ``` @@ -1698,14 +1698,14 @@ import os = os.popen('').read() ``` -#### Sends '1 + 1' to the calculator and captures its output: +#### Sends '1 + 1' to the basic calculator and captures its output: ```python >>> from subprocess import run >>> run('bc', input='1 + 1\n', capture_output=True, encoding='utf-8') CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='') ``` -#### Sends test.in to the calculator running in standard mode and saves its output to test.out: +#### Sends test.in to the basic calculator running in standard mode and saves its output to test.out: ```python >>> from shlex import split >>> os.popen('echo 1 + 1 > test.in') @@ -1788,7 +1788,7 @@ import csv .writerow() # Encodes objects using `str()`. .writerows() # Appends multiple rows. ``` -* **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!** +* **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!** ### Parameters * **`'dialect'` - Master parameter that sets the default values.** diff --git a/index.html b/index.html index b60ed65..936bd2e 100644 --- a/index.html +++ b/index.html @@ -1437,7 +1437,7 @@ value = args.<name>

File Object

<file>.seek(0)                      # Moves to the start of the file.
 <file>.seek(offset)                 # Moves 'offset' chars/bytes from the start.
 <file>.seek(0, 2)                   # Moves to the end of the file.
-<bin_file>.seek(±offset, <anchor>)  # Anchor: 0 start, 1 current pos., 2 end.
+<bin_file>.seek(±offset, <anchor>)  # Anchor: 0 start, 1 current position, 2 end.
 
@@ -1527,7 +1527,7 @@ value = args.<name>
os.chdir(<path>)                    # Changes the current working directory.
 os.mkdir(<path>, mode=0o777)        # Creates a directory. Mode is in octal.
 
-
shutil.copy(from, to)               # Copies the file. 'to' can be a directory.
+
shutil.copy(from, to)               # Copies the file. 'to' can exist or be a dir.
 shutil.copytree(from, to)           # Copies the directory. 'to' must not exist.
 
os.rename(from, to)                 # Renames/moves the file or directory.
@@ -1541,12 +1541,12 @@ shutil.rmtree(<path>)               # Deletes t
 <str> = os.popen('<shell_command>').read()
 
-

Sends '1 + 1' to the calculator and captures its output:

>>> from subprocess import run
+

Sends '1 + 1' to the basic calculator and captures its output:

>>> from subprocess import run
 >>> run('bc', input='1 + 1\n', capture_output=True, encoding='utf-8')
 CompletedProcess(args='bc', returncode=0, stdout='2\n', stderr='')
 
-

Sends test.in to the calculator running in standard mode and saves its output to test.out:

>>> from shlex import split
+

Sends test.in to the basic calculator running in standard mode and saves its output to test.out:

>>> from shlex import split
 >>> os.popen('echo 1 + 1 > test.in')
 >>> run(split('bc -s'), stdin=open('test.in'), stdout=open('test.out', 'w'))
 CompletedProcess(args=['bc', '-s'], returncode=0)
@@ -1604,7 +1604,7 @@ CompletedProcess(args=['bc', 'newline=""' argument, or an extra '\r' will be added to every '\n' on platforms that use '\r\n' line endings!
+
  • 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!
  • Parameters

    • 'dialect' - Master parameter that sets the default values.
    • diff --git a/parse.js b/parse.js index aaa9614..5a322cf 100755 --- a/parse.js +++ b/parse.js @@ -35,7 +35,7 @@ const OS_RENAME = 'os.replace(from, to) # Same, but overwrites \'to\' if it exists.\n'; const SHUTIL_COPY = - 'shutil.copy(from, to) # Copies the file. \'to\' can be a directory.\n' + + 'shutil.copy(from, to) # Copies the file. \'to\' can exist or be a dir.\n' + 'shutil.copytree(from, to) # Copies the directory. \'to\' must not exist.\n'; const EVAL =