Python - Count elements in list [duplicate] Python - Count elements in list [duplicate] python python

Python - Count elements in list [duplicate]


len()

>>> someList=[]>>> print len(someList)0


just do len(MyList)

This also works for strings, tuples, dict objects.


len(myList) should do it.

len works with all the collections, and strings too.