>### >>>> myform = '''this is a test form > > with some carriage\r\n returns in it.''' >>>> myform = myform.replace('\r', '') >### > or simply use strip(), which will remove leading and trailing whitespace of any kind. Which, in this instance seems like the right thing to do. There is also rstrip() which only strips from the right.