Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to Get the length of all items in a list of lists in Python

a_list_of_lists = [[1,2,3], [4,5,6], [7,8,9]]
length = sum([len(sub_list) for sub_list in a_list_of_lists])
print(length)
# Returns: 9
Source by www.howtouselinux.com #
 
PREVIOUS NEXT
Tagged: #How #Get #length #items #list #lists #Python
ADD COMMENT
Topic
Name
4+5 =