from pathlib import Pathprint("File Path:", Path(__file__).absolute())print("Directory Path:", Path().absolute()) # Directory of current working directory, not __file__
from pathlib import Path
#Returns the path of the current directorymypath = Path().absolute()print('Absolute path : {}'.format(mypath))
#if you want to go to any other file inside the subdirectories of the directory path got from above methodfilePath = mypath/'data'/'fuel_econ.csv'print('File path : {}'.format(filePath))
#To check if file present in that directory or NotisfileExist = filePath.exists()print('isfileExist : {}'.format(isfileExist))
#To check if the path is a directory or a Fileisadirectory = filePath.is_dir()print('isadirectory : {}'.format(isadirectory))
#To get the extension of the filefileExtension = mypath/'data'/'fuel_econ.csv'print('File extension : {}'.format(filePath.suffix))