1try:
2 obj = iter(obj)
3
4 except:
5 raise TypeError("obj is not iterable")
6
7finally:
8 print ("obj is iterable")
9
10from collections import Iterable
11
12if isinstance(obj, Iterable):
13 print ("obj is iterable")
14
15else:
16 print ("obj is not iterable")