import os print('File name : ', os.path.basename(__file__)) print('Directory Name: ', os.path.dirname(__file__))