list files in seperate directory python code example
Example 1: get all files within multiple directories python
from pathlib import Path
for f in Path().cwd().glob("../*.ext"):
print(f)
# do other stuff
Example 2: list files python
#get all .txt files in my_path
import glob
my_path='/home/folder/'
files=glob.glob(my_path+'*.txt')