Py-StackExchange通过标签过滤 [英] Py-StackExchange filter by tag
问题描述
我正在使用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中的所有问题.我想知道是否有一个参数可以按标签过滤问题列表,即python
,loops
等仅返回该标签中的问题.我一直在网上搜寻搜索结果,甚至阅读了一些脚本,都花了将近一个小时的时间,但是我什么也找不到.
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']
将过滤同时标记为python
和loops
的问题.
Specifying tagged=['python', 'loops']
will filter question that is tagged both python
and loops
.
这篇关于Py-StackExchange通过标签过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!