Python double quotes | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Python double quotes

Can someone please explain the following? "double quotes cant be directly included in a double string". Thank you.

24th Feb 2018, 11:12 PM
arbaaz
3 Respostas
+ 5
If you want to print the following: ā€œNo!ā€, she said. You cant use: print(ā€œā€No!ā€, she said.ā€) Because the quotes will mess up with the string. I believe thats what your sentence there means. But you could use: print(ā€˜ā€œNo!ā€, she said.ā€™) Because then Python will know what you want.
24th Feb 2018, 11:30 PM
Pedro Demingos
Pedro Demingos - avatar
+ 3
It goes the same with single quotes. You need to use the escape character backslash '\' on each single or double quote to make it work. Check this code: https://code.sololearn.com/cNs0q66noLwf/?ref=app
25th Feb 2018, 12:00 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Thank you for your answers.
26th Feb 2018, 7:35 PM
arbaaz