How to get a list of built-in modules in python?

前端 未结 6 1493
野的像风
野的像风 2020-12-04 14:22

I would like to get a list of names of built-in modules in python such that I can test the popularity of function\'s naming conventions (underline, CamelCase or mixedCase).<

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 15:00

    Now there is a 3rd party package for this. It scrapes the TOC of the Standard Library page in the official Python docs and builds a list.

    You can install it using pip

    pip install stdlib_list
    

    and got get a list of libraries

    In [12]: from stdlib_list import stdlib_list
    
    In [13]: libraries = stdlib_list("3.5")
    
    In [14]: libraries[4:12]
    Out[14]: ['abc', 'aifc', 'argparse', 'array', 'ast', 'asynchat', 'asyncio', 'asyncore']
    

    You can find source code here.

提交回复
热议问题