Answers for "__file__ python"

1

__file__ python

A = os.path.join(os.path.dirname(__file__), '..')
# A is the parent directory of the directory where program resides.

B = os.path.dirname(os.path.realpath(__file__))
# B is the canonicalised (?) directory where the program resides.

C = os.path.abspath(os.path.dirname(__file__))
# C is the absolute path of the directory where the program resides.
Posted by: Guest on June-18-2020

Code answers related to "__file__ python"

Python Answers by Framework

Browse Popular Code Answers by Language