>>> import os
>>> os.path.abspath("mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
# Basic syntax:
import os
os.path.basename('/path/to/filename.txt')
# Example usage:
os.path.basename('/path/to/filename.txt')
--> filename.txt
# Note, to get the path instead of the filename, use:
os.path.dirname('/path/to/filename.txt')
--> /path/to