I have two csv files
file1.csv

```
col1,col2,col3
1,2,3
4,5,6
7,8,9

```

file2.csv

```
col1,col2,col3
0,2,3
4,0,6
7,8,9

```

I want to compare these two files column wise output the result to another file.
file3.csv

```
col1,col2
1,0
0,5
0,0

```

The code i tried,

```
import csv
with open('file1.csv', 'r') as t1:
    old_csv = t1.readlines()
with open('file2.csv', 'r') as t2:
    new_csv = t2.readlines()

with open('file3.csv', 'w') as out_file:
    line_in_new = 1
    line_in_old = 1
    leng=len(new_csv)
    out_file.write(new_csv[0])
    while line_in_new < len(new_csv) and line_in_old < len(old_csv):
        if (old_csv[line_in_old]) != (new_csv[line_in_new]):
            out_file.write(new_csv[line_in_new])
        else:
            line_in_old += 1
        line_in_new += 1

```

this is a little altered version from one of the answers here in stackoverflow. How can i achieve a column wise comparision.

Thanks in advance!