len()
函数:它返回一个对象(字符串、列表、元组等)的长度或项目数。例如:
fruits = ["apple", "banana", "cherry"] print("The length of the list is:", len(fruits))
输出:
The length of the list is: 3
len()
函数:它返回一个对象(字符串、列表、元组等)的长度或项目数。例如:
fruits = ["apple", "banana", "cherry"] print("The length of the list is:", len(fruits))
输出:
The length of the list is: 3