I wantd to store the string 'self'
in a variable, which is later used in setting a header.
My first attempts all resulted in just self
(note the absense of the single quotes:
str("'self'")
str(\'self\')
str("\'self\'")
And if I try
str(\\'self\\')
it results in \self\
.
Eventually I got it to work with str("\\'str\\'")
.
Why do I need to double escape the single quotes inside of double quotes? I wasn’t able to find any documentation that explains that.
1 post - 1 participant