Get Filename From Path in Python - Delft Stack
www.delftstack.com › howto › pythonPython Get Filename From Path Using os.path.split () If head and tail are required individually, the os.path.split () method can be used. This method takes path as its argument and returns head and tail of the path. An example code is given below. import os head, tail = os.path.split("/Users/xyz/Downloads") print(head) print(tail) Output: