'How to include a " character in a string? [duplicate]

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?



Solution 1:[1]

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

str1 = 'abc"def'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Code Clickers