import os def profanity_words(): profanity_list = [] __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) file = __location__ + '/profanity-words.txt' with open(file,"r") as profanity: for riga in profanity: riga = riga.replace("\r", "").replace("\n", "") profanity_list.append(riga) return profanity_list