I have not yet seen any article or document citing exactly how to do this in a "great" way. Meanwhile, miku , from StackOverflow in English ,
You can try something like:
1- Assuming that the object is always iterable, and then capturing the error if it is not in the Python style - EAFP (Easier to Ask Forgiveness than Permission) - "better to ask for forgiveness than permission"
try:
_ = (e for e in my_object)
except TypeError:
print my_object, 'is not iterable'
Or:
2- Using the module collections
import collections
if isinstance(e, collections.Iterable):
# e is iterable