[Tutor] print string using triple quote
boB Stepp
robertvstepp at gmail.com
Tue Mar 17 13:26:16 CET 2015
On Mon, Mar 16, 2015 at 11:13 PM, Nick Nguyen
<pythonlearner at yahoo.com.dmarc.invalid> wrote:
>
> Hi,
> I use python 3.4.3.
> I'm using print function with triple quote, as I understand all the character will be printed as exactly within the triple quote, even with the backslash character. However as you see in the RESULT printout, the first backslash come out OK, but it misses the last backslash, unless I put "\\".
> print( ''' ____ _ __ ______ _____ / _ \ | | / / | ___| | _ \
> ''' )
>
> RESULT:
>
> ____ _ __ ______ _____ / _ \ | | / / | ___| | _
>
I started a thread recently:
http://code.activestate.com/lists/python-tutor/103394/
essentially about this same topic. The problem is the backslash
character is used to initiate "escape" sequences. And since every line
ends with with "invisible" line termination character(s) (newline, \n,
carriage return, \r), the backslash at the end of a line interacts
with what is there, whether you can see it or not.
--
boB
More information about the Tutor
mailing list