tags:

views:

65

answers:

3

hello everybody... am looking for method and function watch i can search in web page ! ok I'll explain it : i tell my python file .. go to www.example.com and search for that world "Hello guest" and if my python file found that world "Hello guest" my python file print "the world found!" and if he don't found he print "the world not found"

+2  A: 

Use Python's urllib module to fetch the content, and its re module to look for the word (make sure you use search instead of match; it's a common noob slip-up).

Marcelo Cantos
Mixing up match and search is so common, in fact, that you did it here!
Roger Pate
D'oh! How embarrassing. Fixed.
Marcelo Cantos
+1  A: 

if you need to match exact string, this is faster and less complicated

a = urllib.urlopen('http://www.google.com')

if 'new' in a.read():
    print 'found'
else:
    print 'not found'
damir
+3  A: 

The other answers here I believe are searching the html rather than the rendered content. If that's what you want that's fine, but if you want to exclude stuff in tags then you're probably going to want to look at something that can understand html. Beautiful Soup should be able to help parse it and extract the actual text content (and a lot more)

Davy8