ctrip

#-*—coding:utf8-*-
from lxml import etree
import requests
import re
#编码转换
import sys
reload(sys)
sys.setdefaultencoding("utf-8") headers= { 'User-Agent' : 'User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36' }
html = requests.get('http://flights.ctrip.com/actualtime/BJS-SHA/t20161223', headers = headers ).content
selector = etree.HTML(html) urllist = selector.xpath('//div[@class="search-bd"]/ul/li[@class="fly-row"]/div[@class="inl flight"]/strong/text()') for i in urllist:
print i
上一篇:protostuff java 序列化&&proto 编译&&生成器


下一篇:模拟实现JSON.stringiry 的格式化输出