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

  1. import re
  2. def parse_property_text(text):
  3. properties = dict()
  4. key_value_regex = re.compile(r"(?P<key>^[^=]+)=(?P<value>.*)")
  5. lines = text.split("\n")
  6. for line in lines:
  7. match = key_value_regex.match(line)
  8. if match:
  9. key = match.group("key")
  10. value = match.group("value")
  11. properties[key] = value
  12. return properties