DJ49 DJ49 - 1 month ago 5
Python Question

Read this file and create a dictionary with keys of the type tuple and values of the type float

abcdefghijklmnopqrstuvwxyz try this as list and string and then dictionary and also tuple

with open(filename) as f:
    d = {tuple(x.split(':')[0].strip().split(',')): float(x.split(':')[1].strip()) for x in f}

This is a (fairly complex) dictionary comprehension.