diff --git a/README.md b/README.md index c498142..e43509e 100644 --- a/README.md +++ b/README.md @@ -1179,8 +1179,8 @@ import os ### Subprocess ```python ->>> import subprocess ->>> a = subprocess.run(['ls', '-a'], stdout=subprocess.PIPE) +>>> import subprocess, shlex +>>> a = subprocess.run(shlex.split('ls -a'), stdout=subprocess.PIPE) >>> a.stdout b'.\n..\nfile1.txt\nfile2.txt\n' >>> a.returncode @@ -1421,6 +1421,12 @@ lock.acquire() ... lock.release() ``` +or +```python +lock = RLock() +with lock: + ... +``` Introspection @@ -1701,6 +1707,13 @@ logger.('A logging message') ``` * **Levels: `'debug'`, `'info'`, `'success'`, `'warning'`, `'error'`, `'critical'`.** +```python +try: + ... +except Exception as e: + logger.exception('An error happened', e) +``` + ### Rotation **Parameter that sets a condition when a new log file is created.** ```python