如何获取列表items
中的元素个数?
items = ["apple", "orange", "banana"]
# There are 3 items.
最佳答案
len()
函数可以与 Python 中的几种不同类型一起使用 - 内置类型和库类型。例如:
>>> len([1, 2, 3])
3
关于python - 如何在 Python 中获取列表中元素的数量(列表的长度)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1712227/