I am trying to split the line:
American plaice - 11,000 lbs @ 35 cents or trade for SNE stocks
at the word or
but I receive ValueError: not enough values to unpack (expected 2, got 1)
.
Which doesn't make sense, if I split the sentence at or
then that will indeed leave 2 sides, not 1.
Here's my code:
if ('-' in line) and ('lbs' in line):
fish, remainder = line.split('-')
if 'trade' in remainder:
weight, price = remainder.split('to ')
weight, price = remainder.split('or')
The 'to'
line is what I normally use, and it has worked fine, but this new line appeared without a 'to'
but instead an 'or'
so I tried writing one line that would tackle either condition but couldn't figure it out so I simply wrote a second and am now running into the error listed above.
Any help is appreciated, thanks.