from picture import * import warmup def read_file (f): for line in f: yield line.split(":") def file_to_dictionary(file): lines = {} temp = '' temp_list = [] for x in read_file(file): for y in x: try: if float(y): value = float(y.strip()) temp_list.append('%02g'%value) except ValueError: print y if y == "US" or y == "INT": temp_list.append(y) lines [temp] = temp_list else: lines [temp] = temp_list temp = y return lines file = open ('airport_data.txt') print file_to_dictionary (file)