Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Find Files With a Certain Extension in the Directory and Its Subdirectories in Python

>>> import pathlib
>>> fileDir = r"C:Test"
>>> fileExt = r"***.txt"
>>> list(pathlib.Path(fileDir).glob(fileExt))
[WindowsPath('C:/Test/test.txt'), WindowsPath('C:/Test/test1.txt'), WindowsPath('C:/Test/sub/test1.txt')]
Comment

PREVIOUS NEXT
Code Example
Python :: integer xticks 
Python :: downsample image opencv 
Python :: how to sort dict by value 
Python :: remove zeros from decimal python 
Python :: python check if list 
Python :: django get parameters from url 
Python :: how to get the link of an image in selenium python 
Python :: cardano 
Python :: pycountry 
Python :: converting numpy array to dataframe 
Python :: python sockets 
Python :: django textfield 
Python :: round tuple 
Python :: python 1 line for loop with else 
Python :: python dataclass 
Python :: merge 2 dataframes pythom 
Python :: sklearn predict threshold 
Python :: domain name of my site 
Python :: django createssuperuser 
Python :: add image pptx python 
Python :: this figure includes axes that are not compatible with tight_layout, so results might be incorrect 
Python :: boxplot show values seaborn 
Python :: how to check for a substring in python 
Python :: select all rows in a table flask_ sqlalchemy (python) 
Python :: type de variable python 
Python :: sum of list in python 
Python :: remove special characters from string in python 
Python :: how to check a phone number is valid in python 
Python :: flask print request headers 
Python :: loading in pyqt5 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =