How do I get the length of a list? - Stack Overflow
WebNov 11, 2009 · You can use the len() function to find the length of an iterable in python. my_list = [1, 2, 3, 4, 5] print(len(my_list)) # OUTPUT: 5 The len() function also works with strings: my_string = "hello" print(len(my_string)) # OUTPUT: 5 So to conclude, len() works with any sequence or collection (or any sized object that defines __len__).
DA: 14 PA: 13 MOZ Rank: 88 Up or Down: Up