Get Parent path value (bad design) Help

Peter Kleiweg in.aqua.scribis at nl.invalid
Mon Aug 30 16:35:10 CEST 2004


Golawala, Moiz M (GE Infrastructure) schreef:

> Hi all,
>
> What I am trying to do is write some generic code where I can
> get the path of the parent directory. for example if current
> working directory is 'Z:\\dirA\\Parent\\Child'
>
> I want to get a string which up like 'Z:\\dirA\\Parent'
> Then I do a sys.path.append('Z:\\dirA\\Parent')

path = r'Z:\dirA\Parent\Child'

# or: path = os.getcwd()

parent = os.path.normpath(os.path.join(path, '..'))




-- 
Peter Kleiweg  L:NL,af,da,de,en,ia,nds,no,sv,(fr,it)  S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html




More information about the Python-list mailing list