Snippets Flashcards
1
Q
Ignore exception but print all callstack
A
try: ... except Exception: import traceback traceback.print_exc()
2
Q
Add custom text to exception
A
try: ... except KeyError as exc: raise Exception('text') from exc
3
Q
Nested f-string
A
f”Number {val : {prec} }”