Reputation: 60
I have successfully managed to get tkinter's filedialog imported and used the command
file_found = filedialog.askopenfilename()
print(file_found)
Dialog box opens, I can select and successfully print the full path/file name. What I want to do next is just use the file name so I can use os.rename to change the file's name.
A pointer to the documentation or the how would be gratefully appreciated.
Thank you.
Upvotes: 0
Views: 1066
Reputation: 54787
os.path.basename(file_path)
will that job. The name comes from the bash basename
command, which serves the same purpose.
Upvotes: 2