How to split this string to dict with python?
<p><strong>String</strong>  </p>

<pre><code>string1 = '"{ABCD-1234-3E3F},MEANING1","{ABCD-1B34-3X5F},MEANING2","{XLMN-2345-KFDE},WHITE"'
</code></pre>

<p><strong>Expected Result</strong>  </p>

<pre><code>dict1 = {'{ABCD-1234-3E3F}' : 'MEANING1', '{ABCD-1B34-3X5F}' : 'MEANING2', '{XLMN-2345-KFDE}' : 'WHITE'}  
</code></pre>

<p>Perhaps it is simple question,<br>
Is there any easy method to split <code>string1</code> to <code>dict1</code>?</p>

<pre><code>string1 = '"{ABCD-1234-3E3F},MEANING1","{ABCD-1B34-3X5F},MEANING2","{XLMN-2345-KFDE},WHITE"'
elements = string1.replace('"','').split(',')
dict(zip(elements[::2],elements[1::2]))
</code></pre>

<p>You can first split the original string and extract elements from it. Now you can pair element in odd and even positions and turn them into a dict.</p>

python split