How to find the present working directory using python.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pradeep nair

    #1

    How to find the present working directory using python.

    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.

  • SamG

    #2
    Re: How to find the present working directory using python.

    On May 4, 12:03 pm, pradeep nair <deep...@gmail. comwrote:
    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( )

    Comment

    • pradeep nair

      #3
      Re: How to find the present working directory using python.

      On May 4, 12:05 pm, SamG <mad.vi...@gmai l.comwrote:
      On May 4, 12:03 pm, pradeep nair <deep...@gmail. comwrote:
      >
      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...

      Comment

      • Isaac Rodriguez

        #4
        Re: How to find the present working directory using python.

        how to find out the present working directory using python.
        >
        Try this:

        import os
        os.getcwd()

        It returns the current working directory.

        Thanks,

        - Isaac.

        Comment

        Working...