Python - one line trick to open and close the file in Python [PL]

preview_player
Показать описание
How to open and close the file without having to remember about closing it?
Why you should remember about closing the file?

Use 'with' keyword.

Remember, that's not something you should always use. You can find out more about 'with' keyword in my course.

More about Python:

#pythonshorts #pythonprogramming #pythontutorial
Рекомендации по теме
Комментарии
Автор

if you're using pathlib then text")' is shorter :)

andywhitaker