Help with Python

I am trying to call a CSV File , and creating a new column based on truncated strings of an existing column using Python.

I have :

 import csv
from collections import defaultdict

columns = defaultdict(list) 

with open('file.txt') as f:
            for (k,v) in row.items(): 

but if you want to read and write from a csv file you need to use the csv writer and reader objects, as explained in the documentation: