Import and Packaging Modules
site
Handles site-specific Python startup configuration and package search paths, normally as part of interpreter initialization. The -S option suppresses automatic site setup. Startup customization and .pth files can execute code; avoid running site.main or editing startup paths just to inspect them. The example reads the configured user-site location without displaying a machine-specific path.
Formal Syntax & Structure
python syntaxpython
import siteReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import siteprint(isinstance(site.getusersitepackages(), str))