<meta name="keywords" content="Ruby On Rails (Software), Authentication (Software Genre), Tutorial (Industry), howto, tips, tricks">
如何使用PyQuery从此元标记中获取content
值?
from pyquery import PyQuery
def get_data(myurl):
query = PyQuery(url=myurl)
title = query("title").text()
keyword = query("meta[name=keywords]").text()
...
答案 0 :(得分:1)
你几乎成功了,缺少撇号字符来设置keywork
keyword = query("meta[name='keywords']").text()