Q:

Python Dict Transform

I've been having some strange difficulty trying to transform a dataset that I have. 
I currently have a dictionary coming from a form as follows:
data['content']['answers']

I would like to have the ['answers'] appended to the first element of a list like so:
data['content'][0]['answers']

However when I try to create it as so, I get an empty dataset. 
data['content'] = [data['content']['answers']]

I can't for the life of me figure out what I am doing wrong. 
EDIT: Here is the opening JSON 
I have:
{
"content" : {
              "answers" : {
                "3" : {

But I need it to be:
    {
"content" : [
              {
                 "answers" : {
                  "3" : {

thanks

A:

You can do what you want by using a dictionary comprehension (which is one of the most elegant and powerful features in Python.) 
In your case, the following should work:
d = {k:[v] for k,v in d.items()} 

You mentioned JSON in your question.  Rather than rolling your own parser (which it seems like you might be trying to do), consider using the json module.