标签:user alt mda agent headers header decode pattern 正则表达
import urllibdata=urllib.parse.urlencode(fromdata).encode()
req=request.Request(url,data=data,headers=header)
res=request.urlopen(req).read().decode()
print(res)
#构造正则表达式
pattern=‘"tgt":"(.*?)"}]]‘
result=re.findall(pattern,str(res))
print(result[0])
标签:user alt mda agent headers header decode pattern 正则表达
原文地址:https://blog.51cto.com/13810716/2486950