I want to get rid `\r\n’ characters in my string to do so, I tried this :
s1.translate(dict.fromkeys(map(ord, u"\n\r")))
lists1=[]
lists1.append(s1)
print lists1
I received this:
[u'\r\nFoo\r\nBar, FooBar']
How can I get rid of \r\n characters in my string ?
Use
str()andreplace()to remove bothuand\r\n:or just
replace()to get rid of only\r\n: