I need to split a string using python but only on the first instance of the delimiter in the string.
My code:
for line in conf.readlines():
if re.search('jvm.args',line):
key,value= split('=',line)
default_args=val
The problem is line, which contains jvm.args looks like this:
'jvm.args = -Dappdynamics.com=true, -Dsomeotherparam=false,'
I want my code to split jvm.args into key and value variables incidently upon the first '='. Does re.split do this by default? If not a suggestion would be appreciated!
readlines(), stores a list in memory which is unnecessary. Just iterate over each line by simply doing this:for line in conf