text = "Test~123" print(text) 

Displays:

 Test~123 

And you need to do so that when the output was "Test 123"

Those. remove the sign and replace it with a space

    3 answers 3

    Try:

     >>> print(text.replace('~', ' ')) 

    Test 123

      If you type the query python string replace on Google.com, then we come to the document string.replace (s, old, new [, maxreplace] .

      Your solution would be text.replace('~', ' ') .

        You can also try a regular expression in this case it deletes all characters except letters and numbers.

         import re rep = re.compile("[^a-zA-Zа-яА-я,\d]") text = rep.sub(" ", "Test~123") print(text) # Test 123