I'm trying to create a list of rows that doesn't include 3 specific words.
word_list = ['Banned', 'On_Hold', 'Reviewing']
unknown_row = []
with open('UserFile.csv', newline='') as csvfile:
user_reader = csv.reader(csvfile, delimiter='\t')
for row in user_reader:
joined = ','.join(row)
for i in word_list:
if i in joined:
pass
else:
unknown_row.append(joined)
with open('unkown.csv', 'w', newline='') as output:
writer = csv.writer(output, delimiter=',')
writer.writerows(x.split(',') for x in unknown_row)
Here's the thing, if only one word is included in the word_list, then it works. But if I include two or more words, then it doesn't.
Any ideas?
Thank you