how to export a dictionary into a csv file in python
<p>I have a very big dictionary and want to export into a text or csv file in such a way that keys would be in the first column and values in the 2nd column.
could anyone help to do so?</p>

<p>Simply iterate through the dictionary and output:</p>

<pre><code>with open 'my_csv.csv' as f:
    for k, v in my_dict.items(): # or iteritems in python 2
        f.write("%s,%s\n" % (k, v)) # or whatever format code of your data types
</code></pre>

python