Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import argparse
- import csv
- def is_correct(name):
- l, r = name.split(" - ")
- return l[1:4] != "DPP" and r[1:4] != "DPP"
- parser = argparse.ArgumentParser(description="CSV file parser")
- parser.add_argument('file', type=str, help="name of the CSV file")
- args = parser.parse_args()
- fd = open(args.file, "r")
- reader = csv.DictReader(fd)
- for row in reader:
- if is_correct(row["Name"]):
- print row["Name"], row["Category"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement