Write variable to file, including name
<p>Let's say I have the following dictionary in a small application. </p>

<pre><code>dict = {'one': 1, 'two': 2}
</code></pre>

<p>What if I would like to write the exact code line, with the dict name and all, to a file. Is there a function in python that let me do it? Or do I have to convert it to a string first? Not a problem to convert it, but maybe there is an easier way.</p>

<p>I do not need a way to convert it to a string, that I can do. But if there is a built in function that does this for me, I would like to know.</p>

<p>To make it clear, what I would like to write to the file is:</p>

<pre><code>write_to_file("dict = {'one': 1, 'two': 2}")
</code></pre>
