I'm working with data and I have it set to spit out items I need. Example:
LOT OF 4 American motor vinegar
Lot of (6) 808 metal/steel/G/N LWAP
LOT 12 product number 57838290
What I want is to have it spit out the amount in each lot, could be lowercase or capitalized, if 'lot'
is found in the text. I think I have my code half built, but since the value isn't in a set location I don't know how to retrieve it. Also, the list above is from a TEXT string so it doesn't recognize integers
def auction(title):
for word in title.split():
if word.startswith('lot'):
return # not sure what to return (from the example the answer would be 4 6 and 12)
You can re-write that in the following order:
The base is same as your own, we set the boolean value to True after we found the LOT value (in any upper or lower case). Then we check to see if the word is a digit and if it was, return it's value.