diff --git a/README.md b/README.md index dc284fc..7b6979c 100644 --- a/README.md +++ b/README.md @@ -868,7 +868,7 @@ from functools import partial >>> multiply_by_3(10) 30 ``` -* **Partial is also useful in cases when function needs to be passed as an argument because it enables us to set its arguments beforehand.** +* **Partial is also useful in cases when a function needs to be passed as an argument because it enables us to set its arguments beforehand.** * **A few examples being: `'defaultdict()'`, `'iter(, to_exc)'` and dataclass's `'field(default_factory=)'`.** ### Non-Local @@ -1664,7 +1664,7 @@ from pathlib import Path ``` ### DirEntry -**Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir and on Windows also stat information, thus significantly increasing the performance of code that requires it.** +**Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir, and on Windows also stat information, thus significantly increasing the performance of code that requires it.** ```python = os.scandir(path='.') # Returns DirEntry objects located at the path. @@ -2275,7 +2275,7 @@ log.basicConfig( * **RotatingFileHandler creates and deletes files based on 'maxBytes', 'backupCount' args.** * **An object with `'filter()'` method (or the method itself) can be added to loggers and handlers via addFilter(). Message is dropped if filter() returns a false value.** -#### Creates a logger that writes all messages to file and sends them to the root's handler that prints warnings or higher: +#### Creates a logger that writes all messages to a file and sends them to the root's handler that prints warnings or higher: ```python >>> logger = log.getLogger('my_module') >>> handler = log.FileHandler('test.log', encoding='utf-8') @@ -2523,7 +2523,7 @@ print(f'{python_url}, file://{os.path.abspath(filename)}') # $ pip3 install selenium from selenium import webdriver - = webdriver.Chrome/Firefox/Safari/Edge() # Opens the browser. Also .quit(). + = webdriver.Chrome/Firefox/Safari/Edge() # Opens a browser. Also .quit(). .get('') # Also .implicitly_wait(seconds). = .find_element('css selector', '') # '#.[=""]'. = .find_elements('xpath', '') # '//[@=""]'. diff --git a/index.html b/index.html index 86c4ad5..60f750d 100644 --- a/index.html +++ b/index.html @@ -725,7 +725,7 @@ player = Player(point, direction) # 30
    -
  • Partial is also useful in cases when function needs to be passed as an argument because it enables us to set its arguments beforehand.
  • +
  • Partial is also useful in cases when a function needs to be passed as an argument because it enables us to set its arguments beforehand.
  • A few examples being: 'defaultdict(<func>)', 'iter(<func>, to_exc)' and dataclass's 'field(default_factory=<func>)'.

Non-Local

If variable is being assigned to anywhere in the scope, it is regarded as a local variable, unless it is declared as a 'global' or a 'nonlocal'.

def get_counter():
@@ -1399,7 +1399,7 @@ args  = p.parse_args()                                            <stat> = os.stat(<path>)            # Or: <DirEntry/Path>.stat()
 <num>  = <stat>.st_mtime/st_size/…  # Modification time, size in bytes, ...
 
-

DirEntry

Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir and on Windows also stat information, thus significantly increasing the performance of code that requires it.

<iter> = os.scandir(path='.')       # Returns DirEntry objects located at the path.
+

DirEntry

Unlike listdir(), scandir() returns DirEntry objects that cache isfile, isdir, and on Windows also stat information, thus significantly increasing the performance of code that requires it.

<iter> = os.scandir(path='.')       # Returns DirEntry objects located at the path.
 <str>  = <DirEntry>.path            # Returns the whole path as a string.
 <str>  = <DirEntry>.name            # Returns final component as a string.
 <file> = open(<DirEntry>)           # Opens the file and returns a file object.
@@ -1863,7 +1863,7 @@ log.debug/info/warning/error/critical(<str>)      'filter(<LogRecord>)' method (or the method itself) can be added to loggers and handlers via addFilter(). Message is dropped if filter() returns a false value.
 
-

Creates a logger that writes all messages to file and sends them to the root's handler that prints warnings or higher:

>>> logger = log.getLogger('my_module')
+

Creates a logger that writes all messages to a file and sends them to the root's handler that prints warnings or higher:

>>> logger = log.getLogger('my_module')
 >>> handler = log.FileHandler('test.log', encoding='utf-8')
 >>> handler.setFormatter(log.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s'))
 >>> logger.addHandler(handler)
@@ -2062,7 +2062,7 @@ print(f'{python_url},
 

Selenium

Library for scraping websites with dynamic content.

# $ pip3 install selenium
 from selenium import webdriver
 
-<Drv> = webdriver.Chrome/Firefox/Safari/Edge()         # Opens the browser. Also <Drv>.quit().
+<Drv> = webdriver.Chrome/Firefox/Safari/Edge()         # Opens a browser. Also <Drv>.quit().
 <Drv>.get('<url>')                                     # Also <Drv>.implicitly_wait(seconds).
 <El> = <Drv/El>.find_element('css selector', '<css>')  # '<tag>#<id>.<class>[<attr>="<val>"]'.
 <list> = <Drv/El>.find_elements('xpath', '<xpath>')    # '//<tag>[@<attr>="<val>"]'.