os module get current directory code example
Example 1: working directory python
import os
cwd = os.getcwd()
Example 2: get the previous working directory in python
path = os.path.dirname(__file__)
print(path)
import os
cwd = os.getcwd()
path = os.path.dirname(__file__)
print(path)