-2

Now I am writting an SQL query with such sign: ' but interpreter sees as a start if string. I try to make following 'String1'+%s'+'String2' how can a get

String1 ' String2?

thanks in advance

Fedo
  • 349
  • 1
  • 7

1 Answers1

5

Use double quotes:

>>> s = "String1 ' String2"
>>> s
"String1 ' String2"

Single and double-quotes are mostly interchangeable when defining strings.

Oin
  • 6,951
  • 2
  • 31
  • 55
  • 5
    You can also escape the symbol: `'String 1 \' String 2'` – yeputons Aug 13 '20 at 16:09
  • 2
    @Tomerikoo Sorry, I started typing before yeputons posted, so there was redundancy. However, I would still like to point out that while both methods work, Oin's answer is considered best practice. – samsonjm Aug 13 '20 at 16:17