Python - Integers String to Integer List Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In this article, we will check How we can Convert an Integer String to an Integer List Using split() and map()Using split() and map() will allow us to split a string into individual elements and then apply a function to each element. Python s = "1 2 3 4 5" # Convert the string to a list of integers using split and map int_list = list(map(int, s.split())) print(int_list) Output[1, 2, 3, 4, 5] ExplanationThe split() method splits the input string s into individual string elements based on spaces.The map(int, s.split()) applies the int function to each element, converting them to integers, and list() collects the results into a list, which is then printed as [1, 2, 3, 4, 5].Using List ComprehensionUsing list comprehension allows you to create a new list by applying an expression to each element of an iterable. This method is compact and often more readable than traditional loops, making it ideal for transforming or filtering elements of a list or string. Python # Input string of integers s = "1 2 3 4 5" # Convert the string to a list of integers using list comprehension int_list = [int(i) for i in s.split()] # Print the result print(int_list) Output[1, 2, 3, 4, 5] Explanations.split() method splits the input string s into individual string elements, and the list comprehension [int(i) for i in s.split()] converts each element to an integer.The resulting list of integers [1, 2, 3, 4, 5] is stored in int_list and printed.Using split() and a for LoopUsing split() and a for loop together allows you to split a string into individual elements and then iterate through each element to apply a specific operation, such as converting each element to an integer. Python s = "1 2 3 4 5" # Initialize an empty list int_list = [] # Split the string and iterate over the parts for num in s.split(): int_list.append(int(num)) # Print the result print(int_list) Output[1, 2, 3, 4, 5] ExplanationThe s.split() method splits the input string s into individual string elements, and the for loop iterates through each element.Inside the loop, int(num) converts each string element to an integer, which is then appended to the int_list, resulting in [1, 2, 3, 4, 5]. Comment More info M manjeet_04 Follow Improve Article Tags : Python Python Programs Python string-programs Explore Python FundamentalsPython Introduction 3 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 5 min read Python Keywords 2 min read Python Data Types 7 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 6 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 7 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like