1
<meta name="keywords" content="Ruby On Rails (Software), Authentication (Software Genre), Tutorial (Industry), howto, tips, tricks">

如何content使用 PyQuery 从这个元标记中获取价值?

from pyquery import PyQuery

def get_data(myurl):
    query = PyQuery(url=myurl)
    title = query("title").text()
    keyword = query("meta[name=keywords]").text()
    ...
4

1 回答 1

1

你几乎成功了,缺少撇号字符来设置keywork

keyword = query("meta[name='keywords']").text()
于 2015-07-05T18:27:32.120 回答