请问,我透过browser_cookie3模组捞出Chrome内的指定Domain Cookie值后
透过下面这段可以整齐的显示,但要怎么在一堆Cookie中取出指定NAME的值呢
for item in cookies:
print(item.name+"="+item.value)
找到的教学都是捞出CookieJar后就直接喂给requests
但我只是要取值出来记录而已
谢谢
后续找到一段语法,但是要运用却出现
AttributeError: 'CookieJar' object has no attribute 'find'
def getmidstring(html, start_str, end):
start = html.find(start_str)
if start >= 0:
start += len(start_str)
end = html.find(end, start)
if end >= 0:
return html[start:end].strip()
print(getmidstring(cookies,"NAME=\"","\""))
成功解出来了,只是不知是不是最佳解
for item in cookies:
if(getmidstring(item.name+"="+item.value,"NAME=","\"")!=None):
key=item.value