On Mon, Oct 18, 2010 at 2:24 PM, Devin M <devin...@gmail.com> wrote: > Hello, I am using os.path to get the absolute paths of a few > directories that some python files are in. > FIlePath = os.path.dirname(os.path.realpath(__file__)) > which returns a path similar to /home/devinm/project/files > Now I want to get the directory above this one. (/home/devinm/ > project/) Is there a simple way to do this?
parent_dir = os.path.split(FilePath)[0] Note that os.split() does not work like str.split(). Also, don't use CamelCase for non-classes. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list