Is there a simpler way to get a string of a parent directory than doing the following?
'/'.join(os.getcwd().split('/')[:-1])
Is there a simpler way to get a string of a parent directory than doing the following?
'/'.join(os.getcwd().split('/')[:-1])
I believe this would be much simpler for you
os.path.abspath(os.path.pardir)
or even simpler
os.path.dirname(os.getcwd())
I don't know of a method that does it but I would do something like:
os.path.abspath(os.path.join(os.getcwd(), os.pardir))
EDIT: This way works but Ixanezis way is probably better.