__file__
Dunder AttributePython 2.0+Intermediate
The file path from which a module was loaded
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
# __file__ holds the path of the current module import os print(os.__file__) import json print(json.__file__)
__file__ is a special attribute that the file path from which a module was loaded.
Try in PlaygroundTags
oopintrospectioncore