Python noobie here. I can get “in” to work as normal when I use a normal string like “see spot run”, but it’s not giving me what I would expect from an html page. It ALWAYS returns “not found”.
import urllib2
response = urllib2.urlopen('http://www.cnn.com/')
searchTerm = "center"
if searchTerm in response:
print("found")
else:
print("not found")
Read the documentation for urlopen. It doesn’t return a string, it returns a file-like object. If you want the actual content of the page, call
response.read().