将运算符与地图模块一起使用:
>>> A = [3, 4, 6, 7]>>> B = [1, 3, 6, 3]>>> map(operator.sub, A, B)[2, 1, 0, 4]
就像下面提到的@SethMMorton一样,在Python3中,您需要使用它
>>> A = [3, 4, 6, 7]>>> B = [1, 3, 6, 3]>>> list(map(operator.sub, A, B))[2, 1, 0, 4]
因为,Python中的map会返回迭代器。

将运算符与地图模块一起使用:
>>> A = [3, 4, 6, 7]>>> B = [1, 3, 6, 3]>>> map(operator.sub, A, B)[2, 1, 0, 4]
就像下面提到的@SethMMorton一样,在Python3中,您需要使用它
>>> A = [3, 4, 6, 7]>>> B = [1, 3, 6, 3]>>> list(map(operator.sub, A, B))[2, 1, 0, 4]
因为,Python中的map会返回迭代器。