How to remove the \r\n\r\n from my string output in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to remove the \r\n\r\n from my string output in python?

I have made a copy paste of a title : Learning python When I print it I have as output : ['Learning python\r\n\r\n'] how to get rid of the Unnecessary part \r\n\r\n? Thank you

10th Feb 2021, 11:40 AM
Maximilien
Maximilien  - avatar
2 Answers
+ 8
string.strip() To remove escape characters and whitespaces left and right but not inside the string.
10th Feb 2021, 11:42 AM
noteve
noteve - avatar
+ 3
Thank you it works!
10th Feb 2021, 11:47 AM
Maximilien
Maximilien  - avatar