How to remove quotes from a string using Python


input = input.replace("'","")

The quotes characters from a String object are removed by calling the replace method. The method take the character to remove in input and character to replace it with.


input = "This' is '''a test ' "
output = input.replace("'","")

print( input + " => " + output  )

This example creates a String called input that contains several single quote characters. The method replace is called to create the output String and to remove the quote characters. The content of the output String is written in the output.

The output will be:

This' is '''a test '  => This is a test  


Python String Object

Recent Comments