On Tue, Sep 13, 2016 at 9:19 PM, Daiyue Weng <daiyuew...@gmail.com> wrote: > Could you give me an example of doing this using os.path.split and > os.path.join? > > thanks
Sure, but I'm keeping this on list. os.path.split basically does the same thing you do. # maintaining your non-PEP-8 names rootPath = os.path.abspath(__file__) rootPath = os.path.split(os.path.split(rootPath)[0])[0] os.path.join simply joins pieces together, so you could join a couple of ".." to your path. rootPath = os.path.abspath(os.path.join(__file__, "..", "..")) Advantage: They don't depend on backslashes in file paths, so they'll work on all platforms. ChrisA -- https://mail.python.org/mailman/listinfo/python-list