Re: Multiline parsing of python compiler demistification needed

2016-06-22 Thread Lawrence D’Oliveiro
On Thursday, June 16, 2016 at 8:34:46 PM UTC+12, Yubin Ruan wrote: > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) Try this: print \ ( "A test case" "str_1[%s] " "str_2[%s] " % (str_1, str_2) ) Python takes this n

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Frank Millman
"Yubin Ruan" wrote in message news:930753e3-4c9c-45e9-9117-d340c033a...@googlegroups.com... Hi, everyone, I have some problem understand the rule which the python compiler use to parsing the multiline string. Consider this snippet: str_1 = "foo" str_2 = "bar" print "A test case" + \

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Jussi Piitulainen
Yubin Ruan writes: > Hi, everyone, I have some problem understand the rule which the python > compiler use to parsing the multiline string. > > Consider this snippet: > > str_1 = "foo" > str_2 = "bar" > > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) > >

Re: Multiline parsing of python compiler demistification needed

2016-06-16 Thread Peter Otten
Yubin Ruan wrote: > Hi, everyone, I have some problem understand the rule which the python > compiler use to parsing the multiline string. > > Consider this snippet: > > str_1 = "foo" > str_2 = "bar" > > print "A test case" + \ >"str_1[%s] " + \ >"str_2[%s] " % (str_1, str_2) >

Multiline parsing of python compiler demistification needed

2016-06-16 Thread Yubin Ruan
Hi, everyone, I have some problem understand the rule which the python compiler use to parsing the multiline string. Consider this snippet: str_1 = "foo" str_2 = "bar" print "A test case" + \ "str_1[%s] " + \ "str_2[%s] " % (str_1, str_2) Why would the snippet above give me an "T