×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

Python - Get names of built-in modules of sys module

By IncludeHelp Last updated : February 8, 2024

Problem statement

Write a Python program to get the names of built-in modules of the sys module.

Getting names of built-in modules of sys module

In Python, you can use the builtin_module_names attribute of the sys module to get the names of all built-in modules of the sys module. The sys.builtin_module_names returns a tuple containing names of all built-in modules.

Syntax

sys.builtin_module_names

Python program to get names of built-in modules of sys module

# Importing sys Module
import sys

# Getting built-in module names
builtin_modules = sys.builtin_module_names

# Printing
print(builtin_modules)

Output

The output of the above program is:

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

To understand the above program, you should have the basic knowledge of the following Python topics:

 
 
Advertisement
Advertisement

Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.