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. Advertisements

  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. Advertisements

  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. Advertisements

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:
    829
    Bob Foster
    Dec 24, 2003
  2. Shalini
    Replies:
    2
    Views:
    690
    Brian Genisio
    Jan 9, 2004
  3. Douglass Turner
    Replies:
    1
    Views:
    763
    Paul Boddie
    Sep 4, 2003
  4. vsk
    Replies:
    5
    Views:
    998
  5. Naveen
    Replies:
    1
    Views:
    9,795
    Dirk Michaelsen
    Oct 22, 2008
  6. Wybo Dekker
    Replies:
    1
    Views:
    614
    Yukihiro Matsumoto
    Nov 15, 2005
  7. Charanya Nagarajan
    Replies:
    6
    Views:
    291
    7stud --
    Apr 30, 2009
  8. vdvorkin
    Replies:
    0
    Views:
    599
    vdvorkin
    Feb 10, 2011
Loading...