tkinter filedialog - how to get directory of selected file?
You could use os.path.dirname
for that.
from tkinter import filedialog as fdimport osfilename = fd.askopenfilename()print(os.path.dirname(filename))
You could use os.path.dirname
for that.
from tkinter import filedialog as fdimport osfilename = fd.askopenfilename()print(os.path.dirname(filename))