In Python, you can use multiple context managers on the same block. To do that, simply separate the context manager declarations with a comma.
with context_manager1 as ctx1, context_manager2 as ctx2:
do_stuff()
Source#
Original note
Part of python
In Python, you can use multiple context managers on the same block. To do that, simply separate the context manager declarations with a comma.
with context_manager1 as ctx1, context_manager2 as ctx2:
do_stuff()
Original note