From 0e0b5f5e57ec9a004695d303e5f17a8f7f6818df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 14 Feb 2020 07:12:09 +0100 Subject: [PATCH] Print --- README.md | 6 +++--- index.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ae6d6d..baecd83 100644 --- a/README.md +++ b/README.md @@ -1152,7 +1152,7 @@ class Counter: ### Callable * **All functions and classes have a call() method, hence are callable.** -* **When this cheatsheet uses `''` for an argument, it actually means `''`.** +* **When this cheatsheet uses `''` as an argument, it actually means `''`.** ```python class Counter: def __init__(self): @@ -1465,14 +1465,13 @@ Print ```python print(, ..., sep=' ', end='\n', file=sys.stdout, flush=False) ``` - * **Use `'file=sys.stderr'` for messages about errors.** * **Use `'flush=True'` to forcibly flush the stream.** ### Pretty Print ```python from pprint import pprint -pprint(, width=80, depth=None) +pprint(, width=80, depth=None, compact=False, sort_dicts=True) ``` * **Levels deeper than 'depth' get replaced by '...'.** @@ -1480,6 +1479,7 @@ pprint(, width=80, depth=None) Input ----- **Reads a line from user input or pipe if present.** + ```python = input(prompt=None) ``` diff --git a/index.html b/index.html index 82ec171..f4bac7b 100644 --- a/index.html +++ b/index.html @@ -1096,7 +1096,7 @@ Z = dataclasses.make_dataclass('Z', [File objects returned by the open() function, etc.

Callable

  • All functions and classes have a call() method, hence are callable.
  • -
  • When this cheatsheet uses '<function>' for an argument, it actually means '<callable>'.
  • +
  • When this cheatsheet uses '<function>' as an argument, it actually means '<callable>'.
class Counter:
     def __init__(self):
         self.i = 0
@@ -1369,7 +1369,7 @@ sys.exit(<obj>)                   # Prints the
 
  • Use 'flush=True' to forcibly flush the stream.
  • Pretty Print

    from pprint import pprint
    -pprint(<collection>, width=80, depth=None)
    +pprint(<collection>, width=80, depth=None, compact=False, sort_dicts=True)