After looking at this Removing continuation characters in the middle of a string in Python and documentation on strip() and replace() im am super confused why i cant remove this newline in the middle of a string? I am taking into account that the \ is an escape character in string literals, and it still dont work with a raw string. What am i missing?
import re
data="Token\n Contract:\n 0x7e318f8d6560cd7457ddff8bad058d3073c1223f"
data2="Token\n Contract:\n 0x7e318f8d6560cd7457ddff8bad058d3073c1223f"
result = data.replace(r'\n', "")
result2 =data2.replace('\\n', "")
print(result)
print(result2)