File Exercises Practice With pathlib: Python Basics

preview_player
Показать описание
This video takes you through the previous Python Basics:File System Operations, with a focus on practicing the techniques shown. You’ll use the pathlib module to complete file system operations without relying on your graphical user interface (GUI).

This is a portion of the complete course, which you can find here:

The rest of the course covers how to:
- Iterating over the contents of a directory
- Searching for files using wildcards
- Creating sub-directories
- Writing a directory organization script
Рекомендации по теме
Комментарии
Автор

Thank you for thorough lesson. These are very helpful for a beginner

ephraimmotho
Автор

in using shutil.rmtree(), you did not specify the directory as a string ex my_folder. I did follow your tutorial and it works for me too. but when I check chatgpt, this is gpt's reply:

the argument to shutil.rmtree() should indeed be a string or a Path object, enclosed in quotation marks ("") to represent it as a string.

If you didn't specify the argument as a string and it still worked, it might be due to a coincidence or some other part of your code. However, it is not the correct syntax and could potentially lead to unexpected behavior.

To ensure proper usage, the correct syntax for removing a directory named "Test" using shutil.rmtree() is as follows:

shutil.rmtree("Test")


is Chatgpt wrong?

CharlieCocalon