# How to split Integer Into Digits in Python

Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about How to split Integer Into Digits in Python. so without wasting time lets learn about of this.

## How to split Integer Into Digits in Python

1. ##### split Integer Into Digits in Python

to split Integer Into Digits in Python just Use math.ceil().By using math.ceil() you can split Integer Into Digits in Python. Lets learn about of this by given below example:
`import math num = 8798795 result = [(num//(10**i))%10 for i in range(math.ceil(math.log(num, 10))-1, -1, -1)] print(result)` Output : `[8, 7, 9, 8, 7, 9, 5]`

2. ##### How to split Integer Into Digits in Python

to split Integer Into Digits in Python just Use List comprehension.By using List comprehension you can split Integer Into Digits in Python. Lets learn about of this by given below example: `num = 8798795 result = [int(a) for a in str(num)] print(result)` Output : `[8, 7, 9, 8, 7, 9, 5]`

3. ##### python split number into digits

To split Integer Into Digits in Python just Use List comprehension.By using List comprehension you can split Integer Into Digits in Python. Lets learn about of this by given below example: `num = 8798795 result = [int(a) for a in str(num)] print(result)` Output : `[8, 7, 9, 8, 7, 9, 5]`

## Method 1: Use math.ceil()

By using math.ceil() you can split Integer Into Digits. Lets learn about of this by given below example:

``````import math
num = 8798795
result = [(num//(10**i))%10 for i in range(math.ceil(math.log(num, 10))-1, -1, -1)]
print(result)``````

Output :

``[8, 7, 9, 8, 7, 9, 5]``

## Method 2: Use List comprehension

By using List comprehension you can split Integer. Lets learn about of this by given below example:

``````num = 8798795
result = [int(a) for a in str(num)]
print(result)``````

Output :

``[8, 7, 9, 8, 7, 9, 5]``

## Method 3: Use for loop

By using for loop you can split Integer Into Digits. Lets learn about of this by given below example:

``````num = '8798795'
x = 1
result = []
for i in range(0, len(num), x):
result.append(int(num[i : i + x]))
print("The list : " + str(result))``````

Output :

``The list : [8, 7, 9, 8, 7, 9, 5]``

## Method 4: Use int() and slice

By using int() and slice you can split Integer. Lets learn about of this by given below example:

``````mystr = '8798795'
x = 1
res = []
for idx in range(0, len(mystr), x):
res.append(int(mystr[idx : idx + x]))
print("The list : " + str(res)) ``````

Output :

``The list : [8, 7, 9, 8, 7, 9, 5]``

## Conclusion

It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?