import re
formhashRe = re.search('name="formhash" value="(\w+?)"', response.text, re.DOTALL)
refererRe = re.search('name="referer" value="(.*?)"', response.text, re.DOTALL)
print(f"formhashRe = {formhashRe}, refererRe = {refererRe}")
if formhashRe:
formhash = formhashRe.group(1)
else:
formhash = ""
if refererRe:
referer = refererRe.group(1)
else:
referer = ""
文档信息
- 本文作者:zhupite
- 本文链接:https://zhupite.com/python/python-regex.html
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)