A little bit of backstory:

I have a program that allows user to enter a Name(e.g Lisbon), and based on that 
User Input's country, the program will loop through my JSON file and print out all that are relevant/falls under Lisbon's Country(e.g. Jade, John). 

Here's my JSON file:

```
{  
   "user1":{  
      "Country":[  
         "China",
         "USA",
         "Nepal"
      ],
      "Name":[  
         "Lisbon"
      ]
   },
   "user2":{  
      "Country":[  
         "Sweden",
         "China",
         "USA"
      ],
      "Name":[  
         "Jade"
      ]
   },
   "user3":{  
      "Country":[  
         "India",
         "China",
         "USA"
      ],
      "Name":[  
         "John"
      ]
   }
}

```

I'm new to Python and I would like to know how do I export my printed results and at the same time format it nicely onto the CSV file, this is my printed results:

```
Jade : Sweden, China, USA
John : India, China, USA

```

This is how I would like it to look in the CSV file:

```
Name   Country
Jade   Sweden, China, USA
John   India, China, USA

```

This is what I've done so far:

```
def matchCountry():
    userName = raw_input("Enter user's name: ")
    with open('listOfUsers.json') as f:
        data = json.load(f)

    def getId(name):
        for userId, v in data.items():
            if v['Name'][0].lower() == name:
                return userId;

    id = getId(userName)
    for k, v in data.items():
        if any(x in data[id]['Country'] for x in v['Country']):
            if v['Name'][0].lower() != userName.lower():
                print (v['Name'][0] + " : " + ", ".join(v['Country']))

    with open('output.csv', 'ab') as csvfile:
        csvwriter = csv.writer(csvfile)
        for row in result.items():
            csvwriter.writerow(row)

```