Hi Kovid
I have a question from this scenario:
1> I am building the articles list without the RSS:
articles.append(dict(title=title, url=url, description=desc, date=date))
2> I like to control how the article is list within the same section
I add another element to the “dict”. E.g.:
articles.append(dict(sortseq=sortseq, title=title, url=url, description=desc, date=date))
3> right before the “feeds.append”, I do a articles.sort()
But it is not sort by “sortseq”.
I have tried with these kind of format:
s = sorted(s, key = lambda x: (x[1], x[2]))
s = sorted(s, key = operator.itemgetter(1, 2))
s.sort(key = operator.itemgetter(1, 2))
Still have the issue. My questions are :
- Am I ok to add “sortseq” to the list?
- If yes, am I doing this right on the sort()? Do you have an example for me?
Regards,
|