YouTip LogoYouTip

Att List Len

# Python2.x Python List len() Method [![Image 3: Python Lists](#) Python Lists](#) * * * ## Description The len() method returns the number of elements in a list. ## Syntax The syntax for the len() method is: len(list) ## Parameters * list -- The list whose number of elements is to be counted. ## Return Value Returns the number of elements in the list. ## Example The following example demonstrates the usage of the len() function: #!/usr/bin/python list1, list2 = [123, 'xyz', 'zara'], [456, 'abc']print "First list length : ", len(list1);print "Second list length : ", len(list2); The output of the above example is: First list length : 3Second lsit length : 2 [![Image 4: Python Lists](#) Python Lists](#)
← Att List MaxAtt List Cmp β†’