[Tutor] Getting the directory the program is in

Tor Hildrum torhildrum at gmail.com
Mon Dec 11 17:56:48 CET 2006


On 12/11/06, Toon Pieton <pytutmail at gmail.com> wrote:
> Hey friedly users!
>
> I was wondering: how can I get the directory the program is in? For example
> "C:\Python Programs\Calculator\".

>>> os.path.split.__doc__
'Split a pathname.  Returns tuple "(head, tail)" where "tail" is\n
everything after the final slash.  Either part may be empty.'

The full pathname is in sys.argv[0]


More information about the Tutor mailing list