I want to read multiples lines from a .txt
file.
Each line represents a question that is going to be answered by a NLTK Python script, then the answer will be written in another .txt file.
I succeeded to make this mechanism work, but only for one line (one question) in the Question.txt file (the file from where the questions are being taken).
As I see the scenario, I would like to read a line from the Question.txt file, then the script will answer and write the answer in the Answer.txt file. Then the second line will be read from the Question.txt file and so on.
myFile = open("Questions.txt", 'r')
user_response=str(myFile.splitlines()) # Convert the content of the txt file from list format to string format in order to be able to lower the characters later
#I also made this little implementation in order for the code not to run infinitely, so to count the number of lines :
numOfLines = len(user_response.splitlines())
numofLines -= 1