I want to strip double quotes from:
string = \'\"\" \" \" \"\"\\\\1\" \" \"\" \"\"\'
to obtain:
string = \'\" \" \" \"\"\\\
If you can't assume that all the strings you process have double quotes you can use something like this:
if string.startswith('"') and string.endswith('"'):
string = string[1:-1]
Edit:
I'm sure that you just used string
as the variable name for exemplification here and in your real code it has a useful name, but I feel obliged to warn you that there is a module named string in the standard libraries. It's not loaded automatically, but if you ever use import string
make sure your variable doesn't eclipse it.