Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'subject:Python': 0.05; 'executed': 0.07; "subject:' ": 0.07; 'python': 0.09; '__future__': 0.09; 'difference,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'terry': 0.09; 'thx': 0.09; 'aug': 0.13; '2.7.2': 0.16; 'exit()': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:between': 0.16; 'wrote:': 0.17; 'jan': 0.18; '>>>': 0.18; 'windows': 0.19; 'bit': 0.21; 'import': 0.21; 'meant': 0.21; 'planned': 0.22; 'produces': 0.22; 'statement': 0.23; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; '(3)': 0.27; 'header:X -Complaints-To:1': 0.28; 'prints': 0.29; 'words': 0.29; 'print': 0.32; 'to:addr:python-list': 0.33; 'everyone': 0.33; '(c)': 0.33; 'version': 0.34; 'there': 0.35; 'received:org': 0.36; 'two': 0.37; 'subject:: ': 0.38; '2010,': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'between': 0.63; 'more': 0.63; 'subject:there': 0.65; 'reserved.': 0.67; "'3'": 0.84; '8bit%:65': 0.84; 'difference.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:any': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Is there any difference between print 3 and print '3' in Python ? Date: Mon, 10 Sep 2012 03:16:48 -0400 References: <5128580.32.1332762326119.JavaMail.geo-discussion-forums@pbom7> <645baeaa-438e-4d30-a559-0db4231ede9c@googlegroups.com> <504CAAAA.3090905@feete.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: 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: 71 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347261438 news.xs4all.nl 6843 [2001:888:2000:d::a6]:33175 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28806 On 9/10/2012 2:33 AM, Dwight Hutto wrote: > > > On Sun, Sep 9, 2012 at 10:41 AM, Ian Foote > wrote: > > On 09/09/12 14:23, iMath wrote: > > =E5=9C=A8 2012=E5=B9=B43=E6=9C=8826=E6=97=A5=E6=98=9F=E6=9C=9F=E4= =B8=80UTC+8=E4=B8=8B=E5=8D=887=E6=97=B645=E5=88=8626=E7=A7=92=EF=BC=8C__i= Math=E5=86=99=E9=81=93=EF=BC=9A > > I know the print statement produces the same result when > both of these two instructions are executed ,I just want to= > know Is there any difference between print 3 and print '3' > in Python ? > > thx everyone > > > Here's a future import though I used,so I can use the planned 3 with a > 2x python version in the command line interpreter: > > Microsoft Windows [Version 6.1.7600] > Copyright (c) 2009 Microsoft Corporation. All rights reserved. > > C:\Users\david>c:\python26\python.exe > Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> exit() > > C:\Users\david>c:\python27_64\python.exe > Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit > (AMD64)] on win > 32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import __future__ > >>> x =3D 3 > >>> y =3D '3' > >>> print(x) > 3 > >>> print(y) > 3 > >>> > >>> type(x) > > >>> type(y) > > > >>> z =3D '%i' % (3) > >>> type(z) > > >>> > > In other words type(value), and find out the difference. print(x) prints str(x), which is meant to be a 'friendly'=20 representation. To see a difference, >>> print(repr(3)) 3 >>> print(repr('3')) '3' --=20 Terry Jan Reedy