Hey i got the following code:
import urllib
source = urllib.urlopen('WEBPAGE').read()
if 'STRING TO LOOK FOR' in source:
print 'MESSAGE'
else:
print 'else MESSAGE'
which checks a webpage source code for a specific string, is there a way that only the first lets say 20 lines of the code get searched through for the string? and if the string is not in there i get the else Message?
Change
if 'STRING TO LOOK FOR' in source:toSplit the source into lines and then reassemble the first 20 lines.