Python double quotes | Sololearn: Learn to code for FREE!

+3

Python double quotes

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

2/24/2018 11:12:38 PM

arbaaz

3 Answers

New Answer

+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.

+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

+1

Thank you for your answers.