[Solved] Create python dictionary from TXT file – value aggregation
No need to bother with pandas. Text files are iterable. Just open it, operate on the line (string) and fill a dictionnary. file = “font.txt” with open(file, “r”) as f: dic = dict() for line in f: x = line.strip(“\n”).split(” “) key = int(x[0].strip(“px”)) value = int(x[1]) if key not in dic.keys(): dic[key] = [value] … Read more