I have the following following String Array:
from tkinter import filedialog as fd
pathName = fd.askopenfilename(filetypes=[('Python file','*.py')])
Output
#pathName = 'C:UsersUserDesktopmy_program.py
Is there a way to extract the name of my file? In this example I would want the output to be “my_program”
Or a better solution for me would be to load directly file path without the file’s extension. I need ti pathName to be ‘C:UsersUserDesktopmy_program’
I tried using tkinter’s fd.askopenfilename but it always gets the file extension too.