中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Python dict() 函數(shù)

Python 內置函數(shù) Python 內置函數(shù)


描述

dict() 函數(shù)用于創(chuàng)建一個字典。

語法

dict 語法:

class dict(**kwarg)
class dict(mapping, **kwarg)
class dict(iterable, **kwarg)

參數(shù)說明:

  • **kwargs -- 關鍵字
  • mapping -- 元素的容器。
  • iterable -- 可迭代對象。

返回值

返回一個字典。

實例

以下實例展示了 dict 的使用方法:

>>>dict() # 創(chuàng)建空字典 {} >>> dict(a='a', b='b', t='t') # 傳入關鍵字 {'a': 'a', 'b': 'b', 't': 't'} >>> dict(zip(['one', 'two', 'three'], [1, 2, 3])) # 映射函數(shù)方式來構造字典 {'three': 3, 'two': 2, 'one': 1} >>> dict([('one', 1), ('two', 2), ('three', 3)]) # 可迭代對象方式來構造字典 {'three': 3, 'two': 2, 'one': 1} >>>

Python 內置函數(shù) Python 內置函數(shù)

其他擴展