小编Lio*_*dde的帖子

如何从Python中的括号和花括号中获取数据?

我正在尝试使用py-web-search模块从谷歌搜索中提取信息.拉动搜索的结果就是这个(如Github中所述):

{
    'url': '...',
    'expected_num': 5,
    'received_num' : 5, # There will be a difference in case of insufficient results
    'start': 2,
    'search_engine': 'google',
    'total_results': ...,
    'results':
    [
        {
            'link': '...',
            'link_text': '...',
            'link_info': '...',
            'related_queries': [...],
            'additional_links':
            {
                linktext: link,
                ...
            }
        },
        ...
    ]
}
Run Code Online (Sandbox Code Playgroud)

我似乎无法弄清楚如何打印出"链接"数据.

result=Google.search(query='hello world', num=5, start=0, country_code="es")
data=result['results']
print(data)
Run Code Online (Sandbox Code Playgroud)

这是我的测试代码,只能打印[].有什么建议?

python

2
推荐指数
1
解决办法
343
查看次数

标签 统计

python ×1