Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35989
| References | <e7c60393-8d39-40f8-9e7a-800b39169721@googlegroups.com> |
|---|---|
| Date | 2013-01-03 01:21 +1100 |
| Subject | Re: why the output is different when i am implementig multiline string |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1568.1357136513.29569.python-list@python.org> (permalink) |
On Thu, Jan 3, 2013 at 1:00 AM, <stringsatif1@gmail.com> wrote: >>>> '''hello > world''' > 'hello\nworld' >>>> fred=''' hello > world''' >>>> print(fred) > hello > world That's because repr() converts the newline into "\n", while print renders it literally. Check out repr() in the docs: http://docs.python.org/3/library/functions.html?highlight=repr#repr ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
why the output is different when i am implementig multiline string stringsatif1@gmail.com - 2013-01-02 06:00 -0800 Re: why the output is different when i am implementig multiline string Chris Angelico <rosuav@gmail.com> - 2013-01-03 01:21 +1100 Re: why the output is different when i am implementig multiline string Dave Angel <d@davea.name> - 2013-01-02 09:22 -0500
csiph-web