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 nifty feature from C where multiple string literals in a row 
are implicitly concatenated into a single string.

If you come from a Java or C# background, you probably didn’t know about this, 
because those languages neglected to include this facility.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to