[Solved] how do I count unique words of text files in specific directory with Python? [closed]

textfile=open(‘somefile.txt’,’r’) text_list=[line.split(‘ ‘) for line in textfile] unique_words=[word for word in text_list if word not in unique_words] print(len(unique_words)) That’s the general gist of it solved how do I count unique words of text files in specific directory with Python? [closed]

[Solved] Python: Reading marks from a file then using marks to get class

import csv # function to process data def process_data(data): for item in data: marks = int(item[2]) mclass=”incorrect data entry try again” if marks == 0: mclass = “10.9” elif marks >= 0 and marks <= 100: mclass = “10.{}”.format(10 – int(item[2][0])) yield ‘”{}”,”{}”,{},{}’.format(item[0],item[1],item[2],mclass) # read data to memory data = [] with open(“Maths_Mark.txt”, “r”) as … Read more