Write a Python program to extract the filename from a given path.

Write a Python program to extract the filename from a given path.

1
2
3
4
import os
print()
print(os.path.basename('/users/system1/student1/homework-1.py'))
print()

Final output

Leave a Comment