Skip to content

Commit 0a1e976

Browse files
committed
this is a test file
0 parents  commit 0a1e976

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

xiachufang.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import urllib
4+
import urllib2
5+
from lxml import etree as ET
6+
import sys
7+
reload(sys)
8+
sys.setdefaultencoding('utf-8')
9+
url='http://m.xiachufang.com/search/?keyword='
10+
data=urllib.quote('酸菜鱼')
11+
data=urllib2.urlopen(url+data)
12+
resp=data.read()
13+
html=ET.HTML(resp)
14+
rst=html.xpath('''//header[@class="name ellipsis font19 bold"]/text()''')
15+
for i in rst:
16+
print i

0 commit comments

Comments
 (0)