map()用法
map()是python的内置函数,会根据提供的函数对指定序列做映射。
语法:
map(func, iter, ...)
其中func为一个功能函数,iter表示可迭代参数序列。...,python会取最短的那个进行截断
a = [1, 2, 3, 4]
b = [2, 3, 4]
b = map(lambda x, y: x*y, a, b)
print(list(b))
以上代码将输出...:[2, 6, 12]
dict()用法
python中字典是一种可变容器模型,且可存储任意类型对象。...创建字典
x = dict()
x = {"one": 1, "two": 2, "three": 3}
访问字典的值
x = {"one": 1, "two": 2, "three": 3}
print...中map的基本用法示例
Python3 字典