Pliki listy Python w bieżącym katalogu
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 glob, os
os.chdir("/mydir")
for file in glob.glob("*.txt"):
print(file)
import os
files_and_directories = os.listdir("path/to/directory")
import os
print(os.listdir('/path/to/folder/to/list'))
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
import glob
print(glob.glob("/home/adam/*"))