# -*- coding: cp936 -*-
import urllib2
import re
def u(url):
#connect to a URL
website = urllib2.urlopen(url)
#read html code
html = website.read()
#use re.findall to get all the links
links = re.findall(‘"((http|ftp)s?://.*?)"‘, html)
print u‘有:‘,len(links),u‘个‘
url=raw_input(‘url:‘)
u(url)
时间: 2024-10-11 00:54:46