How to get only the last part of a path in Python? May 13, 2022 by IT Nursery In Python, suppose I have a path like this: /folderA/folderB/folderC/folderD/ How can I get just the folderD part? 10 Answers 10