1

I'm trying to mount a data structure as follows, I'm not sure how to set the breakpoint in the first "value"

x = '2019-04-24 17:37:51.535793 product:coca-cola value:3.00 Qtd.1 T:3.00 | product:coca-cola 1L. retornavel value:4.00 Qtd.2 T:8.00 |'

t=re.findall(r'product:(.+) value:([\d\.]+) Qtd\.([\d]) T:([\d\.]+) ', x)

result:

[('coca-cola value:3.00 Qtd.1 T:3.00 | product:coca-cola 1L. retornavel','4.00', '2', '8.00')]

Needs to stop on the first encounter with "value:" not the last I wanted this

[('coca-cola', '3.00', '1', '3.00'),('coca-cola 1L.', '4.00', '2', '8.00')]
SyntaxVoid
  • 2,501
  • 2
  • 15
  • 23
Alex Wolf
  • 11
  • 1

0 Answers0