Write a script that parses text from a file and prints some output when field X equals a given value.
Asked in the loop scripting round stage. Any language; described as simple.
Treat the file content as CSV with a header row. Implement filter_csv(text, field, value), returning matching records as a list of dictionaries. Preserve row order and compare field values exactly. The requested field is guaranteed to exist in the header.
def filter_csv(text, field, value):