Understanding "with" and Python's context managers
1 هزار بار بازدید -
11 ماه پیش
-
Why do we use "with"
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.
11 ماه پیش
در تاریخ 1402/08/15 منتشر شده
است.
1,010
بـار بازدید شده