云计算开发:Python内置函数-dict()函数详解

 人参与 | 时间:2026-11-22

描述

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

语法

以下是 dict 方法的语法:

class dict(**kwarg)

class dict(mapping, **kwarg)

class dict(iterable, **kwarg)

参数

**kwargs -- 关键字

mapping -- 元素的容器。

iterable -- 可迭代对象。

返回值

返回一个字典。

实例

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


顶: 42543815踩: 41289