Файлы списка Python в текущем каталоге
import os
files = os.listdir('.')
print(files)
for file in files:
# do something
Soggy Boi
import os
files = os.listdir('.')
print(files)
for file in files:
# do something
import os
print(os.listdir('/path/to/folder/to/list'))
from pathlib import Path
for txt_path in Path("/path/folder/directory").glob("*.txt"):
print(txt_path)
lstJson = [f for f in os.listdir(str(self.pathJson)) if f.endswith('.json')]
return lstJson
import os
arr = os.listdir()
print(arr)
>>> ['$RECYCLE.BIN', 'work.txt', '3ebooks.txt', 'documents']
import os
path = '/folder1/folder2/'
files = os.listdir(path)