Determine whether an object is an iterable object:
The method is to judge the Iterable type of the collections module
>>> from collectoins import Iterable
>>>isinstance('abc',Iterable) #str is iterable
>>>isinstance([1,2,3],Iterable) #Is the list iterable
>>>isinstance(123,Iterable) #Whether the integer is iterable
If you want to implement a JAVA-like subscript loop for LIST, you can use Python's built-in enumerate function to turn a LIST into an index-element pair, so that you can iterate over the index and the element itself in the for loop at the same time.
>>> for i, value in enumerate(['a','b','c']);
>>> print i, value
Result returned: 0,a
1,b
2,c