You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
384 B
14 lines
384 B
import re
|
|
|
|
|
|
def parse_property_text(text):
|
|
properties = dict()
|
|
key_value_regex = re.compile(r"(?P<key>^[^=]+)=(?P<value>.*)")
|
|
lines = text.split("\n")
|
|
for line in lines:
|
|
match = key_value_regex.match(line)
|
|
if match:
|
|
key = match.group("key")
|
|
value = match.group("value")
|
|
properties[key] = value
|
|
return properties
|