on-internet
← Community

What does os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) mean? python

Stack Overflow ·

In several SO's question there is these lines to access the parent directory of the code, e.g. os.path.join(os.path.dirname(__file__)) returns nothing and os.path.join(os.path.dirname(__file__)) returns nothing import os, sys parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)) sys.path.append(parentddir) I understand that os.path.abspath() returns absolute path of something and sys.path.append() adds the path for the code to access. but what is this cryptic line below, what does it really mean? os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pa

Comments

Sign in or sign up to comment and upvote.

No comments yet.