Can't you match more directly?
>>> import re >>> >>> line1 = '"tel 555-669", "duration 6", "number 2.", "Price 3.58"' >>> r = re.search(r"(Price)\s(\d.\d+)", line1) >>> d = r.groups() >>> d ('Price', '3.58') >>> d = dict([d]) >>> d {'Price': '3.58'} >>> d['Price'] '3.58' >>> float(d['Price']) 3.58Did also match Price so could make a dictionary.
pythonduffer Wrote:Then I inserted a couple of lines to force a delay.Can use timeit that is made for measure execution of small code snippets.