Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import argparse
  2. import csv
  3.  
  4. def is_correct(name):
  5.     l, r = name.split(" - ")
  6.     return l[1:4] != "DPP" and r[1:4] != "DPP"
  7.  
  8. parser = argparse.ArgumentParser(description="CSV file parser")
  9. parser.add_argument('file', type=str, help="name of the CSV file")
  10.  
  11. args = parser.parse_args()
  12.  
  13. fd = open(args.file, "r")
  14. reader = csv.DictReader(fd)
  15.  
  16. for row in reader:
  17.     if is_correct(row["Name"]):
  18.         print row["Name"], row["Category"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement