以下实例展示了map() 的使用方法:. Python2.x 实例. >>> def square(x) : # 计算平方数 ... return x ** 2 ... map(square, [1,2,3,4,5]) # 计算列表各个元素的平方
確定! 回上一頁