I am total beginner so keep this as simple, as possible. I am attempting to make this particular code to work but I am not understanding, what is really happening in this if any(post.title...
loop.
import feedparser
d = feedparser.parse('feed0.rss', 'r')
with open("./mystuff.txt", 'r') as mystuff:
mylines = mystuff.readlines()
for post in d.entries:
for myline in mylines:
---> if any(post.title in myline for myline in mylines):
print( "Here is one: " + post.title + " " + post.link )
My attempts to get an answer from Reddit (/r/learnpython
) has failed and hopefully someone here can help me to understand this.
Second problem is that this code prints out the "Here is one: " + post.title +
as many times as there is lines in mystuff.txt.