How to make the case insensitive the result of a search entered with an input on a text. For example if I enter "Poésie" he will find But if I enter "poésie" he will not find.
I do not know how to use the Regex Re.ignorecase method for the INPUT variable
here is a simple example
import os
rep_cour = os.getcwd()
file = open(rep_cour+"/data/testmultiple/text1.txt","r")
search_word = input("enter a word you want to search in file: ")
if(search_word in file.read()):
print("word found")
else:
print("word not found")
thank you
edit : With the casefold() method it works
I found the solution as suggested by StarckOverflow here :
str.casefold is recommended for case-insensitive string matching