import os
os.getcwd()
# print current working directory in python
import os
cwd = os.getcwd()
print(cwd)
# If by "current working directory" you mean
# the directory in which is saved the script in execution, then:
import os
cwd = os.path.dirname(os.path.realpath(__file__))
print(cwd)
# How to Print the current working directory
import os
print os.getcwd()
# Import the os module
import os
# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))
# Change the current working directory
os.chdir('/tmp')
# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))
import os
os.getcwd()
import pathlib
print(pathlib.Path(__file__).parent.absolute())
import os
print("File location using os.getcwd():", os.getcwd())
print(f"File location using __file__ variable: {os.path.realpath(os.path.dirname(__file__))}")