I am trying to replace the backslash '\' in a string with the following code
string = "<P style='TEXT-INDENT'>\B7 </P>" result = string.replace("\",'')
result:
------------------------------------------------------------ File "<ipython console>", line 1 result = string.replace("\",'') ^ SyntaxError: EOL while scanning string literal
I donβt need backslashes here, because in fact I am parsing the xml file with the tag in the above format, therefore, if the backslash is displayed there invalid token during parsing
Can I learn how to replace backslash with empty string in python
python replace
shiva krishna
source share