content: str with open("smic.txt") as f: content = f.read() def get_smic_data() -> dict[str: float]: smic_data: dict[str: float] = {} for line in content.splitlines(): year, _, _, _, _, value = line.split(" ") value = value.replace(",", ".") smic_data.update({year: float(value)}) return smic_data