tags:

views:

110

answers:

3

i have quotes inside a string like this

string1="blah blah blah "  some'  thi'ng "  end of string "

how do i make sure the quotes are included in there?

please note i have both doubel and single quotes in there

+5  A: 

Triple quotes are harder to break.

string1="""blah blah blah "  some'  thi'ng "  end of string """
Ignacio Vazquez-Abrams
+1 although apparently SO's syntax highlighter has just broken it :)
BoltClock
+1  A: 

You can use \" to make quotes not break quotes.

wheaties
+1  A: 

if you don't want to go through the whole string putting a backslash before every offending quote, i'd enclose the string in triple quotes. this is especially good for a string that will span several lines.

asia1281