Py-StackExchange通过标签过滤 [英] Py-StackExchange filter by tag

查看:97
本文介绍了Py-StackExchange通过标签过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Py-StackExchange从Stack Overflow获取最近的问题列表.我知道有一种方法可以获取不断列出的问题:

I'm using Py-StackExchange to get a list of recent questions from Stack Overflow. I know there is a way to get just a constant list of questions:

import stackexchange

so = stackexchange.Site(stackexchange.StackOverflow)

for question in so.questions(pagesize=10):
    print question

但这将返回SO中的所有问题.我想知道是否有一个参数可以按标签过滤问题列表,即pythonloops等仅返回该标签中的问题.我一直在网上搜寻搜索结果,甚至阅读了一些脚本,都花了将近一个小时的时间,但是我什么也找不到.

But this returns all questions across SO. I'm wondering if there is a parameter to filter the questions list by tag, i.e. python, loops, etc to only return questions in that tag. I've been cruising the web for almost an hour searching for results, even reading through some of the scripts, but I can't find anything.

推荐答案

使用tagged关键字参数.

例如:

for question in so.questions(tagged=['python'], pagesize=10):
    print question
    assert 'python' in question.tags

指定tagged=['python', 'loops']将过滤同时标记为pythonloops的问题.

Specifying tagged=['python', 'loops'] will filter question that is tagged both python and loops.

这篇关于Py-StackExchange通过标签过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆