Home How to get the number of elements in a list in Python?
Reply: 0

How to get the number of elements in a list in Python?

user5916
1#
user5916 Published in September 19, 2018, 11:03 am
items = []
items.append("apple")
items.append("orange")
items.append("banana")

# FAKE METHOD::
items.amount()  # Should return 3

How do I get the number of elements in the list?

share|improve this question
  • 17
    You are obviously asking for the number of elements in the list. If a searcher comes here looking for the size of the object in memory, this is the actual question & answers they are looking for: How do I determine the size of an object in Python? – Aaron Hall Oct 31 '16 at 14:37

6 Answers 6

active oldest votes
up vote 2185 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.50543 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO