Let's say I have the following dictionary in a small application. dict = {'one': 1, 'two': 2} 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. 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. To make it clear, what I would like to write to the file is: write_to_file("dict = {'one': 1, 'two': 2}") Continue reading...