- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to locate a particular module in Python?
For a pure python module you can find the location of the source files by looking at the module.__file__. For example,
>>> import mymodule >>> mymodule.__file__ C:/Users/Ayush/mymodule.py
Many built in modules, however, are written in C, and therefore module.__file__ points to a .so file (there is no module.__file__ on Windows), and therefore, you can't see the source.
Running "python -v" from the command line tells you what is being imported and from where. This is useful if you want to know the location of built in modules.
- Related Articles
- How to locate descendant elements of a particular type of elements in jQuery?
- How to locate all the descendant elements of a particular type of element?
- How to write a python module?
- How to install a Python Module?
- How to develop a Python Module?
- How to list all functions in a Python module?
- How to retrieve Python module path?
- How to delete an installed module in Python?
- How to use the Subprocess Module in Python?
- How to import a single function from a Python module?
- Import a module in Python
- Python + Selenium | How to locate elements in span class & not unique ID
- How to prohibit a Python module from calling other modules?
- How to import a Python module given the full path?
- How to Compress files with ZIPFILE module in Python.

Advertisements