os.path contains this information.
import os
print(os.getcwd()) #of the current directory
print(os.path.realpath(_file__))#File
print(os.path.dirname(os.path.realpath(_file__)))#directory where the file is located
© 2024 OneMinuteCode. All rights reserved.