I try to replace a sentence with another both including some ; character inside but it doesn't work , when I delete that character then the script works but I need that character to be included.
It's not the ; that's the problem, it's the quote immediately before it. You need to escape every quote that's in your string, or, because Python is great, you can just use a single quote, and then you don't need to escape your double quotes.
Hi,
I try to replace a sentence with another both including some ; character inside but it doesn't work , when I delete that character then the script works but I need that character to be included.
Here is the code I use :
editor.replace("\"Parent";"- bad_br7001";"\"", "\"Parent";"bad_br7001";"TU\"")
I'd like to replace
> "Parent";"- bad_br7001";""
by that > "Parent";"- bad_br7001";"TU"
thanks for your help
It's not the ; that's the problem, it's the quote immediately before it. You need to escape every quote that's in your string, or, because Python is great, you can just use a single quote, and then you don't need to escape your double quotes.
So, easiest:
or, to correct your version:
You can see from the syntax highlighting that it thinks the string is ended before the semi-colon, because the semi colon is coloured differently.
Cheers,
Dave.