Get Wd In Python

Source URL: https://note.nkmk.me/en/python-os-getcwd-chdir/

Language: python

Created on: 2020-01-26 15:29:57

import os

path = os.getcwd()

print(path)
# /Users/mbp/Documents/my-project/python-snippets/notebook

print(type(path))
# <class 'str'>
In Python, you can get and change (set) the current working directory with os.getcwd() and os.chdir().os module is included in the standard library, so no additional installation is required.os — Miscellaneous operating system interfaces — Python 3.7.4 documentation This article describes the foll...
content_copy