分类: Python/Ruby
2009-09-24 18:31:43
#filename:URLLister.py
from sgmllib imp
class URLLister(SGMLParser):
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#这是一个文件读取的类FileRead.py
def readFile(filename):
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#test_urllister.py
from URLLister imp
imp
from FileRead imp
#usock= urllib.urlopen("")
parser=URLLister()
#parser.feed(usock.read())
text=readFile(r"D:\书籍\linux\我的linux备份\新增\xinhua.htm")
parser.feed(text)
#usock.close()
parser.close()
for url in parser.urls: