Writing a dict to flat file without brackets in python
<p>I have this dict:</p>

<pre><code>my_dict = {'1': {'a', 'b'},
          '2': {'b', 'd'},
          '3': {'c'}
          }
</code></pre>

<p>I need to write it to a flat file then I wrote this code:</p>

<pre><code>with open("myfile", 'w') as f:
    for key, value in my_dict.items():
        f.write('{} {}\n'.format(key, value))
</code></pre>

<p>I got this:</p>

<pre><code>2 {'d', 'b'}
1 {'b', 'a'}
3 {'c'}
</code></pre>

<p>It works (order doesn't matter) but I need the output file without any extra character, just the values of the dict keys and values itself, something like this:</p>

<pre><code>1 a
2 b
3 c
</code></pre>

<p>How can I do it?</p>