About 11,500,000 results
Open links in new tab
  1. Python - Convert Number to List of Integers - GeeksforGeeks

    Jan 28, 2025 · List comprehension provides a Pythonic way to convert a number into a list of integers. Explanation: str () function is used to convert the number into a string. list comprehension iterates over each character of the string, …

  2. python - Converting integer to digit list - Stack Overflow

    What is the quickest and cleanest way to convert an integer into a list? For example, change 132 into [1,3,2] and 23 into [2,3].

  3. python - Convert all strings in a list to integers - Stack Overflow

    There are several methods to convert string numbers in a list to integers. In Python 2.x you can use the map function: Here, It returns the list of elements after applying the function. In Python 3.x you can use the same map.

  4. Converting an int into a python List - Stack Overflow

    Mar 2, 2014 · All the three ways runs equally in time: ...: return list(map(int, str(num))) ...: res=[] ...: while num>0: ...: res.append(num%10) #or try divmod(n, 10) if you like builtins. ...: num//=10. ...: return res[::-1] ...: return [int(digit) for digit in str(num)]

  5. How to Convert an Integer to a List in Python - HatchJS.com

    There are three main ways to convert an integer to a list in Python: 1. Using the `list ()` function. 2. Using the `range ()` function. 3. Using the ` ()` operator. Using the `list ()` function. The simplest way to convert an integer to a list is to use the `list ()` function.

  6. 5 Best Ways to Convert a Number to a List of Integers in Python

    Mar 11, 2024 · 💡 Problem Formulation: In Python programming, it’s common to have a scenario where you need to take a single multi-digit number and break it down into its constituent digits as a list of integers. For instance, converting the integer 12345 to the list [1, 2, 3, 4, 5]. Method 1: Using ‘map’ and ‘int’

  7. How to Convert an Integer to a List in Python - Finxter

    Aug 22, 2022 · This article will show you how to convert a single Integer into a List in Python. Python has several built-in Data Type Structures: one of them being a List. The List Data Structure is made up of square brackets ([]) containing elements separated by a comma (,).

  8. Convert Number to List & Vice Versa in Python (Examples)

    How to turn a number into a list and vice-versa in Python (examples) - Number into list using for loop - int() and join() functions

  9. Convert Number to List of Integers in Python - Online Tutorials …

    May 20, 2020 · Explore how to efficiently convert a number to a list of integers in Python with our easy-to-follow guide.

  10. 5 Best Ways to Convert an Integer to a List of Digits in Python

    Feb 18, 2024 · For example, if we have the integer 1234, our goal is to transform it to a list [1, 2, 3, 4]. This article elucidates five different methods to achieve this conversion in Python, each with its use cases and advantages.

  11. Some results have been removed
Refresh