Get the current working directory (the path where your Python script is being executed) in Python:
**Method 1: Using `os.getcwd()`**
python
import os
print(os.getcwd())
This will print the absolute path of the current working directory.
**Method 2: Using `__file__` variable**
python
import os
print(os.path.dirname(__file__))
This will print the directory where your Python script is located. The `__file__`
variable returns the path to the current Python file, and `os.path.dirname()` removes the
filename part.
**Method 3: Using `sys.argv[0]`**
python
import sys
print(os.path.dirname(sys.argv[0]))
This will also print the directory where your Python script is located. The first
argument (`sys.argv[0]`) is the path to the current Python file, and `os.path.dirname()`
removes the filename part.
Note that these methods may return different results if you're running the script from a
IDE or interactive shell environment, so be sure to test them in your specific use case.