How to Filter from CSV file using Python Script

csv, filter, python

Solution

import csv
reader = csv.reader(open(r"abx.csv"),delimiter=' ')
filtered = filter(lambda p: 'Central' == p[2], reader)
csv.writer(open(r"abx.csv",'w'),delimiter=' ').writerows(filtered)

Problem

I have abx.csv file having three columns. I would like to filter the data which is having `Application` as `Central` and write it in same .csv file ``` User ID Name Application 001 Ajohns ABI 002 Fjerry Central 900 Xknight RFC 300 JollK QDI 078 Demik Central ``` I need to write `User ID,Name,Apllication` in three column in same .csv file (modifying the existing file)

Original source