List of All Files With Specific Extensions in Directory (Python Example)

Опубликовано: 28 Июль 2020
на канале: Data Science Garage
3,758
63

How to make a list of files with specific extensions (for example images, video, documents, etc.) in a directory by using Python. The result is: a file list (list variable in Python) containing all filenames found on all included subdirectories of root folder with needed extensions, such as JPG, PNG, JPEG, etc.

For this tutorial I used only Python os module (no glob). That's it! And one simple Python procedure make all the magic. Explanation is in video.

In video example I choose to try example of extracting all filenames of images from all subdirectories found in root directory. Example root directory - caltech101

Hoping it will help to data scientist or data analyst who working with local data or want to pre-process big amount of data for machine learning, deep learning or a simple data science project.

#pythonprogramming
#pythontutorial
#pythontricks


Смотрите видео List of All Files With Specific Extensions in Directory (Python Example) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Data Science Garage 28 Июль 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,758 раз и оно понравилось 63 людям.