Файлы списка 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
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
import os
#this command will store all .txt files in same directories
ALL_FILES_IN_DIR = [ELEM for ELEM in os.listdir() if "txt" in ELEM]
#ALL DIRETORIES
ALL_DIR = [ELEM for ELEM in os.listdir() if "." not in ELEM]
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
import os
os.listdir()