"rl":[{"rid":5280018,"rn": 老师我想抽取rl后面的数据 但是用正则写不对
来源:14-11 获取和解析列表页 - 2

慕函数5302194
2020-02-25
nodes_str_match = re.search(“rl: (.)",res) 我这样获取是获取不到的
nodes_str_match = re.search("rl (.)”,res) 这样就是把:后面的全部获取的
写回答
1回答
-
你少了引号
import re
tt = '"rl":[{"rid":5280018,"rn":'
nodes_str_match = re.search('rl":(.*)', tt)
if nodes_str_match:
print(nodes_str_match.group(1))012020-02-27
相似问题
xpath提取数据问题
回答 2
Selenium 返回乱码
回答 3