# -*- coding: utf-8 -*-
import requests
from lxml import etree
import io
url = 'http://*********.com/'
xpath = '//*[@class="lbcon"]/ul/li/a/@href'
content = requests.get(url).content
html = etree.HTML(content)
new_url = html.xpath(xpath)
new_url = '^'.join(new_url)
import requests
from lxml import etree
import io
import sys
url = 'http://*********.com/'
xpath = '//*[@class="lbcon"]/ul/li/a/@href'
content = requests.get(url).content
html = etree.HTML(content)
new_url = html.xpath(xpath)
new_url = '^'.join(new_url)
print(url, new_url)
编码有 utf-8 gbk gb2312 gb18030
参考 http://blog.csdn.net/jim7424994/article/details/22675759