Created
February 11, 2016 18:25
-
-
Save polmuz/cd882b1267e96a60a267 to your computer and use it in GitHub Desktop.
Simple python function to build paths relative to the current file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source http://code.tutsplus.com/articles/diving-into-django--net-2969 | |
import os | |
def rel(*l): | |
""" | |
Create paths relative to this file | |
e.g. | |
rel('tmp', 'bla.txt') -> '<this file dir>/tmp/bla.txt' | |
""" | |
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment