From e0956055d088025bbaa3e9525cfd9031447941d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 27 Dec 2018 01:00:14 +0100 Subject: [PATCH] Pprint and vars --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index caeba76..029fb9d 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,16 @@ String print( [, , end='', sep='', file=]) # Use 'file=sys.stderr' for errors. ``` +#### Pprint: +```python +>>> from pprint import pprint +>>> pprint(locals()) +{'__doc__': None, + '__name__': '__main__', + '__package__': None, ... +} +``` + Regex ----- @@ -979,6 +989,9 @@ Introspection and Metaprograming ``` ```python +>>> vars(z) +{'a': 'abcde', 'b': 12345} + >>> getattr(z, 'a') # Same as Z.__getattribute__(z, 'a') 'abcde'