Hello, I am new to python and regex. I have a large CSV file that has a type field %age compositionthat contains values such as:
'34% passed 23% failed 46% deferred'
How would you split this line so that you get a dictionary object:
{'passed': 34, 'failed': 23, 'deferred': 46} for each row?
I tried this:
for line in csv_lines:
for match in re.findall('[\d\s%%]*\s', line)
but that required the% age value
source
share