现在的位置: 首页 > 综合 > 正文

python re

2012年04月26日 ⁄ 综合 ⁄ 共 479字 ⁄ 字号 评论关闭

>>> 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
>>> 

抱歉!评论已关闭.