Extract file name f...
 
Share:
Notifications
Clear all

Extract file name from path, no matter what the os/path format


myTechMint
(@mytechmint)
Member Moderator
Joined: 1 year ago
Posts: 52
Topic starter  

Which Python library can I use to extract filenames from paths, no matter what the operating system or path format could be?


Quote
Topic Tags
myTechMint
(@mytechmint)
Member Moderator
Joined: 1 year ago
Posts: 52
Topic starter  

Actually, there's a function that returns exactly what you want

import os
print(os.path.basename(your_path))

ReplyQuote