w3resource

Python: Find the available built-in modules

Python Basic: Exercise-78 with Solution

Write a Python program to find the available built-in modules.

Sample Solution-1:

Python Code:

# Import the sys module to access system-specific information.
import sys

# Import the textwrap module to format the list of module names.
import textwrap

# Get a sorted list of built-in module names in the system.
module_name = ', '.join(sorted(sys.builtin_module_names))

# Use textwrap to format the list of module names into lines with a maximum width of 70 characters.
# Then, print the formatted text.
print(textwrap.fill(module_name, width=70))

Sample Output:

_ast, _bisect, _codecs, _collections, _datetime, _elementtree,                                                
_functools, _heapq, _imp, _io, _locale, _md5, _operator, _pickle,                                             
_posixsubprocess, _random, _sha1, _sha256, _sha512, _signal, _socket,                                         
_sre, _stat, _string, _struct, _symtable, _thread, _tracemalloc,                                              
_warnings, _weakref, array, atexit, binascii, builtins, errno,                                                
faulthandler, fcntl, gc, grp, itertools, marshal, math, posix, pwd,                                           
pyexpat, select, spwd, sys, syslog, time, unicodedata, xxsubtype,                                             
zipimport, zlib 

Sample Solution-2:

Python Code:

 help('modules')

Sample Output:

Please wait a moment while I gather a list of all available modules...

/usr/local/lib/python3.6/dist-packages/Bio/GA/__init__.py:14: BiopythonDeprecationWarning: Bio.GA has been deprecated, and we intend to remove it in a future release of Biopython. Please consider using DEAP instead.  If you would like to continue using Bio.GA, please contact the Biopython developers via the mailing list or GitHub.
  BiopythonDeprecationWarning)
/usr/local/lib/python3.6/dist-packages/Bio/NeuralNetwork/__init__.py:15: BiopythonDeprecationWarning: Bio.NeuralNetwork has been deprecated, and we intend to remove it in a future release of Biopython. Please consider using scikit-learn or TensorFlow instead.  If you would like to continue using Bio.NeuralNetwork, please contact the Biopython developers via the mailing list or GitHub.
  BiopythonDeprecationWarning)
/usr/local/lib/python3.6/dist-packages/Bio/SearchIO/__init__.py:211: BiopythonExperimentalWarning: Bio.SearchIO is an experimental submodule which may undergo significant changes prior to its future official release.
  BiopythonExperimentalWarning)
/usr/local/lib/python3.6/dist-packages/Bio/codonalign/__init__.py:27: BiopythonExperimentalWarning: Bio.codonalign is an experimental module which may undergo significant changes prior to its future official release.
  BiopythonExperimentalWarning)
/usr/local/lib/python3.6/dist-packages/Bio/phenotype/__init__.py:101: BiopythonExperimentalWarning: Bio.phenotype is an experimental submodule which may undergo significant changes prior to its future official release.
  BiopythonExperimentalWarning)
/usr/local/lib/python3.6/dist-packages/bokeh/util/deprecation.py:34: BokehDeprecationWarning: 
The bokeh.charts API has moved to a separate 'bkcharts' package.

This compatibility shim will remain until Bokeh 1.0 is released.
After that, if you want to use this API you will have to install
the bkcharts package explicitly.

  warn(message)
/usr/local/lib/python3.6/dist-packages/bokeh/util/deprecation.py:34: BokehDeprecationWarning: MPL compatibility can no longer be successfully maintained, and is now deprecated. All MPL compat functions will be removed completely on the release of Bokeh 1.0. See http://bokeh.pydata.org/en/latest/docs/releases/0.12.5.html for more information
  warn(message)

Python Code Editor:

 

Previous: Write a Python program to test whether the system is a big-endian platform or little-endian platform.
Next: Write a Python program to get the size of an object in bytes.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/python-exercises/python-basic-exercise-78.php