Understanding "with" and Python's context managers

Опубликовано: 06 Ноябрь 2023
на канале: Python and Pandas with Reuven Lerner
1,178
71

Why do we use "with" when opening files? Because "with" invokes the context manager protocol, ensuring that the file is flushed and closed at the end of the block. In this video, I explain what that means, and then show you how the protocol works, and how we can add it to our own classes.


Смотрите видео Understanding "with" and Python's context managers онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Python and Pandas with Reuven Lerner 06 Ноябрь 2023. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 1,178 раз и оно понравилось 71 посетителям.