Path: csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'converts': 0.07; 'newline': 0.07; 'subject:string': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'renders': 0.16; 'repr()': 0.16; 'subject:when': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'jan': 0.18; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; '>>>>': 0.29; "skip:' 10": 0.30; 'url:python': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'world': 0.63; '1:00': 0.84; '2013': 0.84; 'literally.': 0.84; 'url:functions': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LdUVj4uKUFUrfjgZH7G0QmoZHTXN1h+YF9Ymoh2uxps=; b=NIVvNM6mN+NrFJZ3n/wvjO7/dhZr+50S7V1FlVgPX/Rh4yUozOacsNrb70pFSj6MJU zK4XpNUVUUQbxeaUb+CSmqTF05Ak6U2myQ65Hnh62ZrPSJSs0RhJ0Hq3TCz8eDAsmTBf jbvRsBgwqmR4JcXrNx38CmwNSwzXOGV79v3FGIXSm/E8+uE48mB6X29vCc/FYv+t+sBz egmSbbt9KDV0tsW4OsxoY+srWB7qOZdRGqDEmUQKBOFO3FW8n11V9SD6yPzm2B735Hxu d6MkFcRnEXM19bmE5lTavgs2CaZM8FzM9FCSgB+mc1twJIh7lQibo3U34Ln5ejyY10FR +30g== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 3 Jan 2013 01:21:51 +1100 Subject: Re: why the output is different when i am implementig multiline string From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357136513 news.xs4all.nl 6868 [2001:888:2000:d::a6]:43509 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35989 On Thu, Jan 3, 2013 at 1:00 AM, 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