I am trying to write a simple news feed aggregator.
I am using http://code.google.com/p/feedparser/, and I get standard Python 9-tuple time format like (2004, 1, 1, 19, 48, 21, 3, 1, 0) for each post, http://packages.python.org/feedparser/date-parsing.html
How do I compare this time format?
If I want to know if an article in the feed is new or not, is comparing the time the only way?
Thanks a lot!
Comparing time is probably the best way, unless you want to keep every article you’ve ever seen around to filter the full feed against.
The actual comparison of the 9-tuples is quite easy: Python’s default tuple ordering compares elements item-wise:
Which turns out to be exactly what you need.