rank vote view answer url
42 1604 2652232 6 url

怎么样获取一个列表的长度?

items = []
items.append("apple")
items.append("orange")
items.append("banana")

# FAKE METHOD::
items.amount()  # 返回 3

怎么样做才对?


len函数可以用于Python中许多的类型,包括内建类型和标准库类型.

>>len([1,2,3])
3
Copyright © taizilongxu 2018 all right reserved,powered by Gitbook该文件修订时间: 2018-10-17 17:33:54

results matching ""

    No results matching ""