用python提取xml里面的链接源码
因群里朋友需要提取xml地图里面的链接,就写了这个程序。
代码:
#coding=utf-8
import urllib
import urllib.request
import re
url='http://zhimo.yuanzhumuban.cc/sitemaps.xml'
html=urllib.request.urlopen(url).read()
html=html.decode('utf-8')
r=re.compile(r'(http://zhimo.yuanzhumuban.cc.*?\.html)')
big=re.findall(r,html)
for i in big:
print(i)
op_xml_txt=open('xml.txt','a')
op_xml_txt.write('%s\n'%i)
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。

浙公网安备 33010602011771号