I'm currently facing a strange problem. I want to replace the '\0' in strings with 'null' and read through many forums and always saw the same answer:
text_it = "request on port 21 that begins with many '\0' characters,
preventing the affected router"
text_it.replace('\0', 'null')
or
text_it.replace('\x00', 'null')
When I now print the string, I get the following result:
"request on port 21 that begins with many '\0' characters, preventing the
affected router"
Nothing happened.
So I used this method and it worked but it seems to be too much effort for such a small change:
text_it = text_it.split('\0')
text_it = text_it[0] + 'null' + text_it[1]
Any idea why the replace function didn't work?
text_it = text_it.replace('\0', 'null')?