Python语言学习之字母D开头函数使用集锦:del、dict使用方法之详细攻略

简介: Python语言学习之字母D开头函数使用集锦:del、dict使用方法之详细攻略

del、dict使用方法


del


a=1,

del a     #删除变量a,解除a对1的引用




dict()    #创建字典


dict() #dict函数用于创建一个字典。返回一个字典。

dict01=dict(a='a', b='b', t='t')     # 传入关键字

dict02=dict(zip(['one', 'two', 'three'], [1, 2, 3]))   # 映射函数方式来构造字典

dict03=dict([('one', 1), ('two', 2), ('three', 3)])    # 可迭代对象方式来构造字典

print(dict01,"\n",dict02,"\n",dict03)

{'a': 'a', 'b': 'b', 't': 't'}

{'one': 1, 'two': 2, 'three': 3}

{'one': 1, 'two': 2, 'three': 3}




相关文章
|
5天前
|
Python
python函数进阶
python函数进阶
|
5天前
|
安全 Python
Python量化炒股的获取数据函数—get_industry()
Python量化炒股的获取数据函数—get_industry()
13 3
|
5天前
|
Python
Python sorted() 函数和sort()函数对比分析
Python sorted() 函数和sort()函数对比分析
|
5天前
|
Python
Python量化炒股的获取数据函数—get_security_info()
Python量化炒股的获取数据函数—get_security_info()
12 1
|
5天前
|
Python
Python量化炒股的获取数据函数— get_billboard_list()
Python量化炒股的获取数据函数— get_billboard_list()
10 0
|
5天前
|
安全 数据库 数据格式
Python量化炒股的获取数据函数—get_fundamentals()
Python量化炒股的获取数据函数—get_fundamentals()
12 0
|
5天前
|
算法 Python
Python编程的函数—内置函数
Python编程的函数—内置函数
10 0
|
5天前
|
Java C++ Python
30天拿下Python之函数
30天拿下Python之函数
|
6天前
|
Python
Python量化炒股的获取数据函数—get_index_weights()
Python量化炒股的获取数据函数—get_index_weights()
14 0
|
6天前
|
JavaScript Python
Python量化择时的技术指标函数
Python量化择时的技术指标函数
下一篇
无影云桌面