Got the starttag working as a global variable
This commit is contained in:
parent
d11087907d
commit
4865e04986
8
HTTPy.py
8
HTTPy.py
@ -6,8 +6,14 @@ starttag = ""
|
|||||||
|
|
||||||
class MyHTMLParser(HTMLParser):
|
class MyHTMLParser(HTMLParser):
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
|
global starttag
|
||||||
starttag = tag
|
starttag = tag
|
||||||
print starttag
|
#print starttag
|
||||||
|
def handle_data(self, data):
|
||||||
|
#print starttag
|
||||||
|
if starttag == "code":
|
||||||
|
print data
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
conn = httplib.HTTPSConnection("www.python.org")
|
conn = httplib.HTTPSConnection("www.python.org")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user