nntplib downloads content with extra linebreaks

Klaus Alexander Seistrup klaus at seistrup.dk
Sat Jan 6 14:18:15 EST 2007


Rweth wrote:

> I am using nntplib to download archived xml messages from our 
> internal newsgroup. This is working fine except the download 
> of files  to the connected server, has extra embedded lines in 
> them (all over the place), from the
>    s.body(id,afile)  # body method

The 'linebreaks' are probably '\r\n' pairs, so you could do a

	buf.replace('\r\n', '\n')

to convert all such pairs to single LFs (buf being the buffer or 
string that holds the text with 'linebreaks').

Cheers,

-- 
Klaus Alexander Seistrup
http://klaus.seistrup.dk/




More information about the Python-list mailing list