我提取数据集行:
(u"[('x-xss-protection', '1; mode=block'), ('x-powered-by', 'PHP/5.4.21 ZendServer/6.2.0'), ('transfer-encoding', 'chunked'), ('expires', '0'), ('vary', 'Accept-Encoding'), ('server', 'nginx'), ('last-modified', 'Thu, 03 Dec 2015 10:20:02 GMT'), ('connection', 'keep-alive'), ('pragma', 'no-cache'), ('cache-control', 'must-revalidate, post-check=0, pre-check=0, public'), ('date', 'Thu, 03 Dec 2015 10:20:02 GMT'), ('x-cached', 'EXPIRED'), ('content-type', 'text/html')]",)
我想找到“内容类型”。 我试过dict,list,enumerate,str。。。 但什么都不管用:(
元组中的字符串看起来像列表,我建议使用^{} 将其转换为实列表,然后将其转换为dict(只需运行
dict()
函数),并使用'content-type'
作为访问'text/html'
(值)的键:输出:
相关问题 更多 >
编程相关推荐