[Solved] how to find string in text file by compare it with user input using python?


It appears to me that within your list comprehension you just have one minor issue! Instead of:

item for item in textString

within your list comprehension, I would suggest:

item for item in listText

as currently you are iterating through each char of the whole text, rather than each element in the list of the split document.

solved how to find string in text file by compare it with user input using python?