Python中的len()的使用

Python中的len() 方法的作用是返回列表元素个数

#语法
len(list)
def demo():
    list1, list2 = [123, "xyz", "zara"], [456, "abc"]
    print("First list length : ", len(list1))
    print("Second list length : ", len(list2))

 输出结果:

First list length :  3
Second list length :  2

你可能感兴趣的:(Python,python)