# Takes in worddermatoglyphics.csv and wordsuncopyrightable as csv and creates a new file called valid_words.txt # valid_words.txt has the following properties - it is newline delimited, and is sorted. We also remove all duplicates. # cool let's go # use terminal piping operator to redirect output to valid_words.txt with open("wordsdermatoglyphics.csv", "r") as file1, open("wordsuncopyrightable.csv", "r") as file2: word_list_1 = [i.strip() for i in file1.read().split(',') if i] word_list_2 = [i.strip() for i in file2.read().split(',') if i] total_word_set = set() for word in word_list_1: total_word_set.add(word) for word in word_list_2: total_word_set.add(word) for word in sorted(total_word_set): print(word)