我想在字典中拆分文本变量的内容。内容是格式为key = value的行序列。
Owner = [email protected] \r\n Validator = [email protected] \r\n Approver = [email protected] \r\n
谢谢您的帮助。萨尔瓦多
您可以尝试:
♥text = ⊂"Owner = [email protected]\r\nOwner2 = [email protected]"⊃
text.find text ♥text regex ‴(?<keys>.*)=(?<values>.*)‴
for ♥i from 1 to ♥keys⟦count⟧
if ⊂♥i == 1⊃
♥dict = ⟦dictionary⟧♥keys⟦♥i⟧❚♥values⟦♥i⟧
else
♥dict⟦♥keys⟦♥i⟧⟧ = ♥values⟦♥i⟧
end if
end for
dialog ♥dict⟦owner⟧