标签: python string python-3.x list sum
>>> a = "L2-L3" >>> removeword = ["L","-"] >>> add = [sum(int(j) for j in i) for i in a.strip() if i not in removeword] >>> print(add) [2, 3] # expected 5
我想做列表理解中的总和
谢谢