Spaces:
Runtime error
Runtime error
| import csv | |
| import re | |
| def extract_pattern(pattern: str, text: str) -> str | None: | |
| matches = re.findall(pattern, text) | |
| if matches: | |
| extracted = matches[-1] | |
| return extracted | |
| else: | |
| return None | |
| def read_csv_to_dicts(file_path) -> list[dict]: | |
| with open(file_path, mode='r', newline='', encoding='utf-8') as csvfile: | |
| csv_reader = csv.DictReader(csvfile) | |
| rows = [] | |
| for row in csv_reader: | |
| rows.append(row) | |
| return rows | |