python re

>>> url="http://apk.gfan.com/Product/App45021.html"
>>> result=html.content
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'html' is not defined
>>> html=requests.get(url)
>>> result=html.content
>>> pattern=re.compile('版 本 号(.+?)</li>')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 're' is not defined
>>> import re
>>> pattern=re.compile('版 本 号(.+?)</li>')
>>> data1=re.findall(pattern,result)
>>> print type(data1)
<type 'list'>
>>> print len(data1)
1
>>> 

posted @ 2013-07-31 20:12  jlins  阅读(364)  评论(0编辑  收藏  举报