1. 正则提取
import re
indredient = 'Kumquat: 2 cups'
pattern_text = r'(?P<indredient>\w+):\s+(?P<amount>\d+)\s+(?P<unit>\w+)'
p = re.compile(pattern_text)
m = p.match(indredient)
indredient=m.group('indredient')
amount=m.group('amount')
unit=m.group('unit')
(indredient,amount,unit)=m.groups()