title: Storing set of formatted customized string to dictionary using python
body: <p>I need to get the "result" in dict object, I am looping and getting keys and values in the following format, which I have defined in the variable "opp".</p>
  
  <p>What I need is that I want to store the data (i.e is from opp) to a dict.  How can I do this?</p>
  
  <p>Here is my code:         </p>
  
  <pre><code>for service, svc_limits in result.items():
      for limit_name, limit in svc_limits.items():
          for warn in limit.get_warnings():
  
              opp = ("'{service}/'{limit_name}'': '[{u}]'".format(
                                service=service,limit_name=limit_name,u=str(warn))
                    )
  </code></pre>
  
  <p><strong>My sample output:</strong></p>
  
  <pre><code>{"contact": {"permanentnumber":"sample123","tempnum":"jki345"}}
  </code></pre>
  
  <p>From that, I got output as</p>
  
  <pre><code>contact/permanentnumber:sample123
  contact/tempnum:jki345
  </code></pre>
  
  <p>and get it as a separate string datatype.</p>
  
  <p>I need to store this set of strings in dictionary format, to write in the YAML file using dump but it's not working.  Only one set of value gets written into the file.  I need to store both of these values in the new file.</p>
  
  <pre><code>        opp = ("'{service}/'{limit_name}'': '[{u}]'".format(
                              service=service,
                              limit_name=limit_name,
                              u=str(warn)
  
                          )
           )
           samp = {opp}
  </code></pre>
  
  <p>It returns me only Set dtatype, but what I need here is dictionary.</p>
  
  <pre><code>set(["'Contact/'permanentnumber'': '[4]'"]) &lt;type 'set'&gt;
  set(["'Contact/'temporarynum' ': '[4]'"]) &lt;type 'set'&gt;
  </code></pre>
  
  <p>How can I handle this?</p>