Steve Holden wrote: > Werner Amann wrote: > > > Rakesh schrieb: > > > > > >>What I want is to *group the messages belonging to each thread* . > > > > > > Hello > > > > Why not sort with Message-ID and References? > > Attention - it is a Newbie-Solution. > > > > import nntplib > > > > hamster = nntplib.NNTP('127.0.0.1', 119, 'user', 'pass') > > resp, count, first, last, name = hamster.group('comp.lang.python') > > resp, items = hamster.xover(first,last) > > > > start_dic = {} > > re_dic = {} > > numb = 1 > > > > for id,subject,author,date,message_id,references,size,lines in items: > > if 'Re:' not in subject: > > start_dic[subject] = (author, message_id) > > else: > > re_dic[numb] = (subject, author, references) > > numb += 1 > > > > resp = hamster.quit() > > > > for a in start_dic: > > print a > > print start_dic[a][0] > > for b in re_dic: > > if start_dic[a][1] in re_dic[b][2]: > > print '|' > > print ' ->', re_dic[b][0] > > print ' ', re_dic[b][1] > > print > > > Better still, do a Google search on "mail threading algorithm", > implement the algorithm described in > > http://www.jwz.org/doc/threading.html
Thanks a lot for the link. > > and post your implementation back to the newsgroup :-) Sure I would. I would definitely do the same. I am a python newbie and am reading nntp spec (rfc) right now. Once I get a working version I would definitely post the same. -- http://mail.python.org/mailman/listinfo/python-list