Reputation: 408
So I have the following code:
def searchString(toFind, absolute_path) :
soup = BeautifulSoup(urllib2.urlopen(absolute_path).read())
text = soup.get_text()
if toFind in text :
return True
return False
Now say that the string is "aBc"
. The code that I have will return True
only if toFind
exactly matches a string in text
. Is there a way that I can find out if any combination of "aBc"
is present in text
?
Upvotes: 0
Views: 41
Reputation: 11
To do case insensitive search, code will look like this:
def searchString(toFind, absolute_path) :
soup = BeautifulSoup(urllib2.urlopen(absolute_path).read())
text = soup.get_text()
if toFind.lower() in text.lower():
return True
return False
Upvotes: 1