1import os
2
3files = os.listdir('.')
4print(files)
5for file in files:
6 # do something
7
1lstJson = [f for f in os.listdir(str(self.pathJson)) if f.endswith('.json')]
2 return lstJson
1 import os
2 arr = os.listdir()
3 print(arr)
4
5 >>> ['$RECYCLE.BIN', 'work.txt', '3ebooks.txt', 'documents']
6
1from pathlib import Path
2for txt_path in Path("/path/folder/directory").glob("*.txt"):
3 print(txt_path)