How do we use quotation marks in a String?


#1



I want to know how we can you use quotation marks inside the quotation marks required to denote that the variable has a String value.

The error message I am getting for the code below is:
File "python", line 3
brian="Ashley's "cat" and Ashley's dog!"

SyntaxError: invalid syntax


I want the variable brian to be assigned the String value:
Ashley's "cat" and Ashley's dog!

Is it possible to do this?

brian="Ashley's "cat" and Ashley's dog!"

print brian


#2

you can use quotation marks inside apostrophe:

'"some deep qoute"'

and vice versa, if you want to use quotation mark inside quotation marks you need to escape it, to tell python its not the end of string:

"\"another deep quote\""

#3