Sunday, November 17, 2013

WLST reading a property file

thepropertyfile is a regular property file:
bla=value1
mumble=value2=3

This function handles also the case where a value contains a = sign


def getProperties(thepropertyfile):
    properties = dict()
    for line in open(thepropertyfile):
        strippedline = line.strip()
        if "=" in strippedline:
            key,value = line.strip().split('=', 1)
            properties[key] = value
    return properties


to get the value, do properties.get('bla')


No comments: