Question: I am trying to write a dictionary to a csv file in python.
I've tried nearly every tutorial that I could find but did not get a good result yet.
I want to later edit that file in excel but it looks like this right now:

[![enter image description here](https://i.stack.imgur.com/aElEH.png)](https://i.stack.imgur.com/aElEH.png)

My python code:

```
s = file_name
dict = App.get_running_app().get_widget_contents()

with open(s, 'w') as f:
    writer = csv.writer(f)
    for row in dict.items():
        writer.writerow(row)

```

> 
> 1. What I need is that the key is in column A, and the values are in
>  column B.
> 2. Furthermore each row should be used instead of every second
>  row.
> 3. It would be nice to remove the "," between the key and the
>  value.
> 
> 
> 

I am very happy if someone could help me with this.

Greetings,
Finn

Answer: 
```
s = file_name
dict = App.get_running_app().get_widget_contents()

with open(s, 'w') as f:
    writer = csv.writer(f)
    writer.writerow(dict.keys())     #Header
    for row, value in dict.items():
        writer.writerow(value)       #Write Values 

```
you can go with

```
s = file_name
dict = App.get_running_app().get_widget_contents()

with open(s, 'w') as f:
    writer = csv.writer(f)
    for key in dict:
        writer.writerow([key, dict[key]])

```