1
我在Python中使用了feed解析器,我是一个Python初学者。Python和RSS订阅源 - 解析订阅源
for post in d.entries:
if test_word3 and test_word2 in post.title:
print(post.title)
我想要做的是让Feed解析器在RSS Feed中的标题内找到几个字。
我在Python中使用了feed解析器,我是一个Python初学者。Python和RSS订阅源 - 解析订阅源
for post in d.entries:
if test_word3 and test_word2 in post.title:
print(post.title)
我想要做的是让Feed解析器在RSS Feed中的标题内找到几个字。
请注意,和不分布在整个在运营商。
if test_word3 in post.title and
test_word2 in post.title:
应该解决你的问题。你写什么被评估为
if test_word3 and (test_word2 in post.title):
...这变成...
if (test_word3 != "") and (test_word2 in post.title):
简化一点...... 字符串的布尔值是它是否非空。 整数的布尔值是否为非零。
你能告诉我们INPUT是什么,OUTPUT应该是什么? –
使用'和',而不是'&&'。请参阅http://stackoverflow.com/questions/2485466/pythons-equivalent-of-in-an-if-statement – Frangipanes