Quantcast
Channel: Java mon amour
Viewing all articles
Browse latest Browse all 1121

WLST reading a property file

$
0
0
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')

Viewing all articles
Browse latest Browse all 1121

Trending Articles