__path__

Dunder AttributePython 2.0+Advanced

List of paths where a package's submodules can be found

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# __path__ holds package search paths
import os
print(os.__path__ if hasattr(os, '__path__') else 'os has no __path__')

import json
print("json is a package" if hasattr(json, '__path__') else "json is a module")

__path__ is a special attribute that list of paths where a package's submodules can be found.

Try in Playground

Tags

oopintrospectioncore