On 1 May 2007 14:30:12 -0700, mobil <[EMAIL PROTECTED]> wrote: > Hi guys i m trying out newline characters and to clean them up > a\n\n\n\n\n\n\n\n\nsss\n\n\n\n\n\n\n\n\n\n\nvvvv\n\n\n\nvsa\n\n\n\nasf > \n\nafs > > hello guys > > im trying to replace > \n\n\n\n\n\n\n\n\n with \n > > thanks for help > > \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n also with \n as the browser gives > \r carrriage returns > > thanks for any help or pointers
Is this what you were looking for? >>> import re >>> message = '\n\r\n\r\n\n\nhello there\n\r\n!\n' >>> regex = re.compile('[\n\r]+') >>> regex.sub('\n', s) '\nhello there\n!\n' Ian -- http://mail.python.org/mailman/listinfo/python-list