-4

How do we get rid of the 'new lines' symbols '(\r\n)' when using Python to retrieve emails? 1

00 Qant
  • 1
  • 1
  • 3

1 Answers1

0

Using

s = "ABCD\n\r"

s = s.replace("\n", "")
s = s.replace("\r", "")

print(s)

Gives the output:

ABCD

Use replace instead of strip since it does not care about the placement of the speciefied character.

JakobVinkas
  • 1,003
  • 7
  • 23