Sometimes (ex. django templates section at setting.py), a function expects an absolute path, but it's more practical when developing to refer it to the current file position in our code base. The rel function does exactly that.
- import os
- def rel(*x):
- return os.path.normcase(os.path.join(os.path.dirname(__file__), *x))
You need to login to post a comment.