I am currently writing a program where the user is asked to select multiple files.
After selection I want to be able to get just the file name with the extension.
Below is what I have currently.
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
files = filedialog.askopenfilenames()
print(files)
I am still a beginner and trying to learn the language. Right now what is returning is the whole file directory for each file.
('C:/Users/60068533/Downloads/webscrape/DN1.xls', 'C:/Users/60068533/Downloads/webscrape/DN2.xls')
I just want to get the file name with the extension, for example DN1.xls and DN2.xls.
What code can I use to achieve this? Is there a way to also convert it to a string?