Python dict len()给出字典的总长度。
len(dict)
dict - 这是需要计算其长度的字典。
此方法返回长度。
以下示例显示len()方法的用法。
#!/usr/bin/python dict={'Name': 'Learnfk', 'Age': 7}; print "Length : %d" % len (dict)
当无涯教程运行上面的程序时,它产生以下输出-
链接:https://www.learnfk.comhttps://www.learnfk.com/python/dictionary-len.html
来源:LearnFk无涯教程网
Length : 2
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)