How to find the present working directory using python.

Discussion in 'Python' started by pradeep nair, May 4, 2007.

  1. pradeep nair

    pradeep nair Guest

    how to find out the present working directory using python.

    os.system('pwd') works good. But i need some specific one in
    python rather than embedding shell command into python.
     
    pradeep nair, May 4, 2007
    #1
    1. Advertising

  2. pradeep nair

    SamG Guest

    On May 4, 12:03 pm, pradeep nair <> wrote:
    > how to find out the present working directory using python.
    >
    > os.system('pwd') works good. But i need some specific one in
    > python rather than embedding shell command into python.



    os.path.getcwd()
     
    SamG, May 4, 2007
    #2
    1. Advertising

  3. pradeep nair

    pradeep nair Guest

    On May 4, 12:05 pm, SamG <> wrote:
    > On May 4, 12:03 pm, pradeep nair <> wrote:
    >
    > > how to find out the present working directory using python.

    >
    > > os.system('pwd') works good. But i need some specific one in
    > > python rather than embedding shell command into python.

    >
    > os.path.getcwd()




    Thank u...
     
    pradeep nair, May 4, 2007
    #3

  4. > how to find out the present working directory using python.
    >


    Try this:

    import os
    os.getcwd()

    It returns the current working directory.

    Thanks,

    - Isaac.
     
    Isaac Rodriguez, May 4, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf Wahner
    Replies:
    5
    Views:
    656
    Bob Foster
    Dec 24, 2003
  2. Shalini
    Replies:
    2
    Views:
    517
    Brian Genisio
    Jan 9, 2004
  3. vsk
    Replies:
    5
    Views:
    874
  4. Naveen
    Replies:
    1
    Views:
    8,459
    Dirk Michaelsen
    Oct 22, 2008
  5. Charanya Nagarajan
    Replies:
    6
    Views:
    142
    7stud --
    Apr 30, 2009
Loading...

Share This Page