I'm reading output from program like this
test_output = test_run.communicate(input=str.encode(input))[0]
output = test_output .decode('utf-8').strip()
and if program returns new line like this
>>> a
>>> b
it reads it like this(with repr()
)
>>> 'a\r\nb'
I tried removing line breaks with
output.replace(r"\r\n","")
but it's not working, if I print it like regular string it returns
>>> a
>>> b
and repr()
>>> 'a\r\nb'
How can I remove \r\n from my string?