howto obtain directory where current (running) py-file is placed?
openopt at ukr.net
Thu Jun 7 13:19:14 CEST 2007
On Jun 7, 10:18 am, Gerard Flanagan <grflana... at yahoo.co.uk> wrote:
> On Jun 7, 8:39 am, dmitrey <open... at ukr.net> wrote:
And what is the simplest way (without split/join, if exist) to obtain
name of directory parent to directory my_directory_name?
> > Hi all,
> > I guess this question was asked many times before, but I don't know
> > keywords for web search.
> > Thank you in advance, D.
> import os
> d1 = os.path.dirname(__file__)
> d2 = os.path.dirname(os.__file__)
> print d1
> print d2
More information about the Python-list