0
Can you explain - - Integer object isn't iterable?
2 odpowiedzi
+ 2
you will face this error if you are trying to iterate over an integer object
example :
x=1234
for i in x :
print(i)
#Error #integer object isn't iterable
means you can't iterate over an integer..
Solution to this problem :
converting integer into string using str()
x=1234
for i in str(x) :
print(int(i))
#output :
1
2
3
4
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_iterators.asp
+ 1
Thanks Shende