>>> import os
>>> path = '/etc/singfor/passwd/sunny/test.log'
>>>
>>> os.path.dirname(path)
'/etc/singfor/passwd/sunny'
>>>
>>> os.path.basename(path)
'test.log'
>>> import os
>>> path = '/etc/singfor/passwd/sunny/test.log'
>>>
>>> os.path.dirname(path)
'/etc/singfor/passwd/sunny'
>>>
>>> os.path.basename(path)
'test.log'