两个list相减
data1 = [234,333,212]
data2= [544, 123, 765]
#data3 = data2- data1
# Error: TypeError: unsupported operand type(s) for -: 'list' and 'list'
data3 = list(map(lambda x: x[0]-x[1], zip(data2, data1)))
data1 = [234,333,212]
data2= [544, 123, 765]
#data3 = data2- data1
# Error: TypeError: unsupported operand type(s) for -: 'list' and 'list'
data3 = list(map(lambda x: x[0]-x[1], zip(data2, data1)))
本文标题:Python 两个list相减
本文链接:https://www.haomeiwen.com/subject/crytlktx.html
网友评论