这个是网站上的标签
<td style="color:#458c3f; font-size:14px; font-weight:bold; padding-top:15px; padding-bottom:8px;" align="center" class="">环境影响评价文件受理公示—镇江盛润建材有限公司年产6万立方米混凝土砌块砖项目(报告表)(京口区环保局)</td>
有一个一样的align在前面,抓取的话总是抓到第一个
我是这么写的
title = extract_fields(r'<td align="center">(.*?)</tr>', datas,re.S) # 匹配标题
有什么办法只抓第二个吗?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
datas.split('>')[3][:-4]
全丢上去抓到了...
extract_fields返回的是啥,正则应该匹配到的都返回的,是不是这个函数过滤掉了。
pat = 'class="">(.*?)</td>'
title = re.compile(pat).findall(a)#找到匹配字段
pat 是正则表达式;a是你爬下来的文本字符串
这是我的方法,不知道可不可以用