互联网技术 / 互联网资讯 · 2024年1月31日

Python内置函数-map()函数详解与云计算开发相关

Map() 会根据提供的函数对指定序列做映射。

第一个参数 function 以参数序列中的每一个元素调用 function 函数,返回包含每次 function 函数返回值的新列表。

以下是 Map() 函数语法:

Map(function, ITeRable, …)

function — 函数

ITeRable — 一个或多个序列

Python 2.x 返回列表。

Python 3.x 返回迭代器。

以下实例展示了 Map() 的使用方法:

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

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.