580 total contributions
The .basename() method returns the part of a pathname after the last forward-slash.
.basename()
os.path.basename(path_string)
The path_string must be a string or byte data type.
path_string
The following example showcases the .basename() method using a Codecademy course URL:
usVisit uscodeHide codeCodeOutputHide outputHide outputLoading...Run