0

Quotes

What happens when we have a string with enclosed in "somw text "num" "; with double quotes in it when we run the program?

28th Sep 2021, 6:50 AM
Simangolwa Lifwatila
Simangolwa Lifwatila - avatar
6 Respostas
+ 3
SyntaxError
28th Sep 2021, 6:52 AM
Simba
Simba - avatar
+ 3
Or do it like this 'Some text "num" '
28th Sep 2021, 7:04 AM
Simba
Simba - avatar
+ 1
If you want to place double quotes into the string you need to place '\' before it like: "some text \"num\" " Otherwise, as Simba said you will get a Syntax error.
28th Sep 2021, 6:56 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Simba thanks!! Wait uhm is there like a practical explanation to your answer given?
28th Sep 2021, 6:56 AM
Simangolwa Lifwatila
Simangolwa Lifwatila - avatar
0
Aleksei Radchenkov makes sense. Thanks!!
28th Sep 2021, 7:02 AM
Simangolwa Lifwatila
Simangolwa Lifwatila - avatar
0
Or if you are in python you could do: r""" some text " hhhd ' """ Then you could use both types of quotes 😉
28th Sep 2021, 7:09 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar