def makePropDict(propertiesLine): #This will definitively not work if there is more than 3 items in the value fields = propertiesLine.split("|") resultDict = {1: "{\"name\" : fields[0],\"type\" : \"bool\" }", 2: "{\"name\" : fields[0],\"type\" : fields[1] }", 3: "{\"name\" : fields[0],\"type\" : fields[1],\"defval\" : fields[2] }" }[len(fields)] resultDict = eval(resultDict) return resultDict