I have a text and want to search few words in the text. For example the text in the form of string is:
this is a sample string...
and the word which I want to search is something like: sample.json
so the sample
should match in the string partially. And the output should be sample
.
I am using in
and any
to match the strings but these condition don't work.
if any(word.startswith(text.lower())):
# do something
also tried this condition:
if word.lower() in text.lower():
# do something
Any hints? Thanks in advance.