import re def parse_property_text(text): properties = dict() key_value_regex = re.compile(r"(?P^[^=]+)=(?P.*)") 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