1,字符串匹配括号里内容
import re
s = "四五星(9)"
x = re.findall(r'[^()]+', s)[1]
print(x)
#输出:9
import re
s = "四五星(iii)(3333)"
x = re.findall(r'[^()]+', s)[2]
print(x)
#输出:3333
2,匹配以window.wingxViewData[0]= 开头 </script>结尾之间的内容
text = re.findall(r'window.wingxViewData\[0\]=(.*)</script>',response.text)
json_text = json.loads(text[0])
网友评论