import pickle with open('testPickle.p', 'rb') as ch_f: channels = pickle.load(ch_f) out = [] for x in channels.keys(): chName = x dType = channels[x]['data_type'] if dType == 'REAL': dType = "float" elif dType[-3:] == "INT": dType = "integer" elif dType == "BOOL": dType = "boolean" else: print dType out.append("{0} - {1}".format(chName, dType)) for a in sorted(out): print a