python check if variable is iterable
from collections import Iterable
def iterable(obj):
return isinstance(obj, Iterable)
python check if variable is iterable
from collections import Iterable
def iterable(obj):
return isinstance(obj, Iterable)
how to check if an object is iterable in python
try:
obj = iter(obj)
except:
raise TypeError("obj is not iterable")
finally:
print ("obj is iterable")
from collections import Iterable
if isinstance(obj, Iterable):
print ("obj is iterable")
else:
print ("obj is not iterable")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us