Q:

Is there a way to automate the creation of a new text file that contains a dictionary from a different file?

I'm using Python 2.7
Here I create a set of dictionaries:
    day0 = 0
    day1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
            11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
            21, 22, 23, 24, 25]

    month0 = 0
    december = [day0, day1]

    calendar = [month0, december]

Then what I want to do is this:
    file = open("calendarScript.py", "w")
    file.write(calendar) ## Trying to create the calendar in a new doc
    file.close()

But I get this error:
    TypeError: expected a string or other character buffer object

Is there a way to recreate a dictionary in a new document?
Thank you for your help :)
P.s., I just tried this:
    import shutil

    shutil.copy(calendar, newFolder)

And got back this error:
    TypeError: coercing to Unicode: need string or buffer, list found

Trying to find a way to copy a dict to a new file.

A:

The answer to my problem was "dump". What I was trying to do was "dump" to a text file. Thanks to @KFL for this response (link below):
Writing a dict to txt file and reading it back?
    >>> import json
    >>> d = {"one":1, "two":2}
    >>> json.dump(d, open("text.txt",'w'))

He also answered what was going to be my next problem:
    >>> d2 = json.load(open("text.txt"))
    >>> print d2
    {u'two': 2, u'one': 1}

