[Solved] Open and read all text Files in your directory and filter them using regular expression, python

This is using glob rather than listdir, but this might be a possible method. No regular expressions involved here either though. import glob folder_path = “C:\Temp” file_pattern = “\*.txt” search_string = “hello” match_list = [] folder_contents = glob.glob(folder_path + file_pattern) for file in folder_contents: print(“Checking”, file) read_file = open(file, ‘rt’).read() if search_string in read_file: match_list.append(file) … Read more

[Solved] python: (calling all experts out there to help) how do i write a chatbot which can commands and execute a python function?

Well one suggestion is to use NLP Linguistic Features For ease, i will be using spacy import spacy nlp = spacy.load(‘en_core_web_md’) doc = nlp(‘Get me all sales numbers for August in the Delhi’) for token in doc: print(token.text,token.dep_,token.pos_) Output | ‘Word’ | ‘DEPENDENY’ | ‘POS’ | ———————————- |’Get’ | ‘ROOT’ | ‘AUX’ | |’me’, | … Read more