def test(x): return x * 2 mylist = [1, 2, 3, 4, 5] result = list(map(test, mylist)) print(result)
运行结果如下所示: [2, 4, 6, 8, 10]
[2, 4, 6, 8, 10]
https://www.programiz.com/python-programming/methods/built-in/map