>>> import os
>>> pth="/abeja/blanca/zumbas/ebria/de/miel/en/mi/alma/y.te.tuerces"
>>> os.path.split(pth)
('/abeja/blanca/zumbas/ebria/de/miel/en/mi/alma', 'y.te.tuerces')
>>> os.path.dirname(pth)
'/abeja/blanca/zumbas/ebria/de/miel/en/mi/alma'
>>> os.path.basename(pth)
'y.te.tuerces'
>>> os.path.splitext(os.path.basename(pth))
('y.te', '.tuerces')
>>> os.path.splitext(pth)
('/abeja/blanca/zumbas/ebria/de/miel/en/mi/alma/y.te', '.tuerces')
And then to get-last-directory-name-in-a-path
No comments:
Post a Comment