import sysimport repat = r'<ingredients>((.|n)*?)</ingredients>'filename = sys.argv[1]data = open(filename).read()m = re.search(pat,data)if not m: print "No ingredients found" print sys.exit(1)ingredients = m.group(1)pat = r'<items.*?>(.*?)</item>'all = re.findall(pat,ingredients)for item in all: print item
Name (required)
email (will not be published) (required)
Website