1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-15 01:24:29 +02:00

use maxsplit=1 in case there are multiple '=' delimiters

This commit is contained in:
Kelly Brazil
2020-02-28 09:54:07 -08:00
parent 8f954673ab
commit db8c1079dd

View File

@ -188,8 +188,8 @@ def parse(data, raw=False, quiet=False):
output_line['device'] = entries.pop(0)[:-1]
for entry in entries:
key = entry.split('=')[0].lower()
value = entry.split('=')[1]
key = entry.split('=', maxsplit=1)[0].lower()
value = entry.split('=', maxsplit=1)[1]
output_line[key] = value
raw_output.append(output_line)
@ -199,8 +199,8 @@ def parse(data, raw=False, quiet=False):
linedata = data.splitlines()
output_line = {}
for line in linedata:
key = line.split('=')[0].lower()
value = line.split('=')[1]
key = line.split('=', maxsplit=1)[0].lower()
value = line.split('=', maxsplit=1)[1]
output_line[key] = value
raw_output.append(output_line)