Home>
As the title suggests, searching for "Python + Module List" to get a list of Python module names results in the following code.
import pkgutil
for module in pkgutil.iter_modules ():
print (module)
The output for this is
What is the meaning of the rightmost Boolean value (ispkg) though it is output as a list likeModuleInfo (module_finder = FileFinder ('directory path'), name = 'requests', ispkg = True)
ModuleInfo (module_finder = FileFinder ('directory path'), name = 'setuptools', ispkg = True)
ModuleInfo (module_finder = FileFinder ('directory path'), name = 'urllib3', ispkg = True)
?
-
Answer # 1
Related articles
- python api i don't know how to process the returned numbers
- python - i'm going to iterate, but only one result is returned
- python - i don't understand the meaning of the code
- python - how to expand imshow and the meaning of the code
- python - about the meaning of the surprise mark at the beginning of the py file
- i don't understand the meaning of the python pandas code
- i don't understand the meaning of x used in a python pandas lambda expression
- i want to know the meaning and usage of @classmethod in python
- python - meaning of dlib face detection function arguments
- [python] i don't understand the meaning of the error
- meaning of (xxx | yyy | zzz) in python
- python i don't understand the meaning of * (asterisk) in the following cases
Trends
https://github.com/python/cpython/blob/master/Lib/pkgutil.py#L257
It means whether it is a package as it is. Both requests, setuptools, and urllib3 are
ispkg = True
because they are packages that include__ init __. py
, not modules that consist of a single file.