obțineți directorul fișierului python
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
deschideți fișierul în directorul python
path = 'C:\\Users\\Username\\Path\\To\\File'
file=open(path, "r")
dosar python
from os import path
dir_path = path.dirname(__file__)
ce dosar python os
import os
cwd = os.getcwd()
cum să fac ca toate fișierele mele să funcționeze împreună în python
>>> import os
>>> entries = os.listdir('my_directory/')