To get the length/size of a list in Python, we can simply use the built-in
len() function like so:
list =  list.append('foo') list.append('bar') list.append('baz') print(len(list)) # output: 3
len() function takes an object as an argument and returns the total number of items (i.e. the length of the object). It has the following syntax:
Since a list in Python is an object, the
len() function works for it and returns the total number of items in the list.
Hope you found this post useful. It was published . Please show your love and support by sharing this post.