os.getcwd()
os.getcwd() is a Python function in the OS Module category. Returns the current working directory as a string. The syntax is os.getcwd(). Returns: String path. A typical example: import os
os.getcwd() # "/home/user/project". A close sibling is os.chdir(), which changes the current working directory to the given path. A close sibling is os.listdir(), which returns a list of all files and directories in the given path. A close sibling is os.mkdir(), which creates a single directory. Raises FileExistsError if it already exists. A close sibling is os.makedirs(), which creates all intermediate directories as needed (like mkdir -p). More about this category: Operating system interface — file operations, paths, environment variables. For a broader walkthrough, read the OS Module guide. Related OS Module entries: os.chdir(), os.listdir(), os.mkdir(), os.makedirs(), os.remove(), os.rmdir(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.