python获取列表长度

智者不为愚者谋,勇者不为怯者死。这篇文章主要讲述python获取列表长度相关的知识,希望能为你提供帮助。

Get list length in python 3
Examples
len() function
list = [10, 20, 30]
n = len(list)
print(“The length of list is: “, n)
for loop
list = [‘Python’,’java’,’Kotlin’,’Machine Learning’,’Keras’]
size = 0
print(“Length of the input string:”)
for x in list:
size+=1
print(size)
len() function for nested list
nestedList = [‘Krishna’, 20,’John’, [20, 40, 50, 65, 22], ‘Yung’, 11.98]
【python获取列表长度】print(“Original List = “, nestedList)
print(“Length of a Nested List = “, len(nestedList[3]))
??how to get the list length in python??

    推荐阅读