0

I need to find the default "Document" directory path using programmatically using pyhon

import os

print(os.getcwd())

I am able to access the current directory by using above code. How do I get the default "Document" directory.

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
  • 1
    Does this answer your question? [How to get the home directory in Python?](https://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python) Once you have the home directory, it's a simple matter of appending the "Documents" directory. – dspencer Apr 06 '20 at 04:22

1 Answers1

1
os.path.expanduser("~/Documents")

This should be able to achieve what you looking for.

For more documentation , you can refer to https://docs.python.org/2/library/os.path.html.

Jacky Tan
  • 31
  • 1
  • 3