newsgroup lib

Gerrit Holl gerrit at nl.linux.org
Wed Jan 28 08:28:51 EST 2004


Jesper Olsen wrote:
> Is there a python module for accessing newsgroup articles?

You're looking for nntplib

http://www.python.org/dev/doc/devel/lib/module-nntplib.html

For example,

>>> s = NNTP('news.cwi.nl')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to',
>>> last
Group comp.lang.python has 59 articles, range 3742 to 3803
>>> resp, subs = s.xhdr('subject', first + '-' + last)
>>> for id, sub in subs[-10:]: print id, sub
... 
3792 Re: Removing elements from a list while iterating...
3793 Re: Who likes Info files?
3794 Emacs and doc strings
3795 a few questions about the Mac implementation
3796 Re: executable python scripts
3797 Re: executable python scripts
3798 Re: a few questions about the Mac implementation 
3799 Re: PROPOSAL: A Generic Python Object Interface for Python C
Modules
3802 Re: executable python scripts 
3803 Re: \POSIX{} wait and SIGCHLD
>>> s.quit()
'205 news.cwi.nl closing connection.  Goodbye.'

Gerrit.

-- 
5. If a judge try a case, reach a decision, and present his judgment in
writing; if later error shall appear in his decision, and it be through
his own fault, then he shall pay twelve times the fine set by him in the
case, and he shall be publicly removed from the judge's bench, and never
again shall he sit there to render judgement.
          -- 1780 BC, Hammurabi, Code of Law
-- 
PrePEP: Builtin path type
    http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/




More information about the Python-list mailing list