zoukankan      html  css  js  c++  java
  • Python 字典(Dictionary) clear()方法

    Python 字典(Dictionary) clear()方法


    描述

    Python 字典(Dictionary) clear() 函数用于删除字典内所有元素。高佣联盟 www.cgewang.com

    语法

    clear()方法语法:

    dict.clear()

    参数

    • NA。

    返回值

    该函数没有任何返回值。

    实例

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

    #!/usr/bin/python
    
    dict = {'Name': 'Zara', 'Age': 7};
    
    print "Start Len : %d" %  len(dict)
    dict.clear()
    print "End Len : %d" %  len(dict)

    以上实例输出结果为:

    Start Len : 2
    End Len : 0
  • 相关阅读:
    go
    go
    go
    postgresql
    go
    go
    sql
    铂金软件公司
    HRIS 的价值评估
    [转]数据库SQL优化大总结之 百万级数据库优化方案
  • 原文地址:https://www.cnblogs.com/yc10086/p/13345189.html
Copyright © 2011-2022 走看看