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
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.
Use tagged
keyword argument.
For example:
for question in so.questions(tagged=['python'], pagesize=10):
print question
assert 'python' in question.tags
Specifying tagged=['python', 'loops']
will filter question that is tagged both python
and loops
.
来源:https://stackoverflow.com/questions/19898666/py-stackexchange-filter-by-tag