【问题标题】:How to add and concate two variables in same list如何在同一个列表中添加和连接两个变量
【发布时间】:2022-06-15 22:32:10
【问题描述】:
array = [[1676, 196, 159, 29, 'invoice'], [1857, 198, 108, 28, 'date:']]

width = 159+108 = 267
height = 29+28 = 57
label = invoice date:

Required solution: [1676, 196, 267, 57, 'invoice date:']

有没有办法连接字符串并在同一个列表中添加数字

【问题讨论】:

  • 我很困惑,您想将每个列表中的数字相加,但您的解决方案有来自 array[0] 的 2 个数字和来自 array[1] 的 2 个数字
  • 使用内置函数zip

标签: python-3.x


猜你喜欢
  • 2020-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-09
  • 1970-01-01
  • 2021-11-28
相关资源
最近更新 更多