why the output is different when i am implementig multiline string

D

Dave Angel

hello
world

What you're seeing has nothing to do with the triple quotes, and
everything to do with how you're using the debugger. In one case, you
just mention a value, and the debugger magically calls repr() on the
expression. So it adds quotes around it, and turns embedded funny stuff
into escape sequences, because that's what repr() does on a string.

In the second case, you call Python's print function (assuming python 3,
which you didn't specify). it does not call repr(), but just sends the
characters direct to the console.

if you want to see the escape characters in the second case, you should
have either said:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top