Рабочий каталог Python
import os
cwd = os.getcwd()
Happy Hawk
import os
cwd = os.getcwd()
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
import os
files_and_directories = os.listdir("path/to/directory")
from pathlib import Path
for txt_path in Path("/path/folder/directory").glob("*.txt"):
print(txt_path)
import os
print('File name : ', os.path.basename(__file__))
print('Directory Name: ', os.path.dirname(__file__))