Python3 List len()方法

Python 3 教程 · 2019-02-06 11:13:28

描述

len() 方法返回列表元素个数。

语法

len()方法语法:

len(list)

参数

  • list -- 要计算元素个数的列表。

返回值

返回列表元素个数。

实例

以下实例展示了 len()函数的使用方法:

#!/usr/bin/python3

list1 = ['Google', 'Codercto', 'Taobao']
print (len(list1))
list2=list(range(5)) # 创建一个 0-4 的列表
print (len(list2))

以上实例输出结果如下:

3
5

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Heuristic Search

Heuristic Search

Stefan Edelkamp、Stefan Schrodl / Morgan Kaufmann / 2011-7-15 / USD 89.95

Search has been vital to artificial intelligence from the very beginning as a core technique in problem solving. The authors present a thorough overview of heuristic search with a balance of discussio......一起来看看 《Heuristic Search》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试