Optimization of an RE substitution

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed Dec 19 06:13:46 EST 2001


sh at hob.cx (Sean Holdsworth) wrote in news:slrna20tbt.2o4.sh at elf.hob.cx:

> Then I remembered that I'm supposed to be handling 8 bit clean data...
> I realise that even if I come up with a more efficient method of
> doing this I'll still have to use a modified version of smtplib but
> I'd be interested to hear people's suggestions and comments.

Doesn't this have the effect you want:
    	msg = string.replace(msg, '\r\n', '\n')
    	msg = string.replace(msg, '\r', '\n')
    	msg = string.replace(msg, '\n', '\r\n')

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list