37,721
社区成员
发帖
与我相关
我的任务
分享
AcloneA_2dd40={\"allowBlank\":false,\"dataName\":\"我想要的方案\",\"id\":\"jqTextArea55100_Aclon。。。
re.findall(r'"dataName":.*?"id":',html,re.DOTALL)
weekly=re.findall(r'dataName\\":\\"(.*?)\\",\\"id\\":',result_html,re.DOTALL)
result_html=opener.open(request).read().decode('utf-8')
然后
x=re.findall(r'dataName\":\"(.*?)\",\"id\":',result_html,re.DOTALL)
为什么就找不到了呢。result_html里面打印出来确实包含了上面的字符串
import re
s="""AcloneA_2dd40={\"allowBlank\":false,\"dataName\":\"我想要的方案\",\"id\":\"jqTextArea55100_Aclon。。。"""
x=re.findall(r'dataName\":\"(.*?)\",\"id\":',s,re.DOTALL)
print(x)
['我想要的方案']
明明可以
result_html=opener.open(request).read().decode('utf-8')
print(result_html)
weekly=re.findall(r'dataName\":\"(.*?)\",\"id\":',result_html,re.DOTALL)
print(weekly)
#root=etree.HTML(result_html)
import re
s="""AcloneA_2dd40={\"allowBlank\":false,\"dataName\":\"我想要的方案\",\"id\":\"jqTextArea55100_Aclon。。。"""
x=re.findall(r'dataName\":\"(.*?)\",\"id\":',s,re.DOTALL)
print(x)