python: conditional context and ExitStack (intermediate) anthony explains #189

python: conditional context and ExitStack (intermediate) anthony explains #189

anthonywritescode

3 года назад

2,284 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Vinay Keerthi
Vinay Keerthi - 01.01.2021 09:48

Whoa. I can use this to also open multiple files to write into. Brilliant. Thanks Anthony.

Ответить
Tushar Sadhwani
Tushar Sadhwani - 29.12.2020 10:01

If i leave a file open, does it automatically get freed once my python process ends, at least on linux?

Ответить
Jakub Červinka
Jakub Červinka - 28.12.2020 23:38

The third option is very neat. I hope I'll remember it when I'll need it.
So far I've been "writing" to multiple outputs only when using logging with multiple handlers.

Ответить