0

I try to create the following string in Python:

str1 = "abc"def"

But it gives the following error:

File "<ipython-input-4-72818b9defc9>", line 1
  str1 = "abc"def"
                  ^
SyntaxError: invalid syntax

How can I use " in a string in Python?

martineau
  • 119,623
  • 25
  • 170
  • 301
edn
  • 1,981
  • 3
  • 26
  • 56

1 Answers1

1

Just use the ' signs around the string. Example code:

str1 = 'abc"def'
Code Clickers
  • 85
  • 1
  • 10