subject = ['emergency*', 'new ticket*', 'problem with*']
from_to = ['chris*', 'timothy*', 'daniel*', 'david*', 'jason*']
a = open('D:\testfile.csv', 'w')
New to python. So, here's what I'd like to do.
1) Open an excel csv file
2) Search for specific keywords that are in a list
3) If the keywords are found, pull the data that is in the D,E,F columns only. (Since that is where the keywords will be)
4) Write this data to a new file
Example. Search testfile.csv for any of the keywords in the from_to list. If these keywords appear ONLY in the D or E columns of excel AND if the corresponding column F is not equal to the subject list, then write a new file that has the columns of D,E,F and the associated lines, however many there are, with it
Also, I put the stars next to the names/items in the list to denote a wildcard, eg if the from_to contains chris.gmail.com or daniel@yahoo.