Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22177

Re: Is there any difference between print 3 and print '3' in Python ?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject: ?': 0.05; "subject:' ": 0.07; 'subject:Python': 0.07; 'python': 0.11; 'print': 0.15; '10:45': 0.16; 'executed': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:between': 0.16; 'mon,': 0.18; 'string': 0.18; 'received:209.85.210.174': 0.20; 'received:mail- iy0-f174.google.com': 0.20; 'wrote:': 0.21; 'produces': 0.22; 'statement': 0.22; 'string,': 0.22; 'header:In-Reply-To:1': 0.22; 'message-id:@mail.gmail.com': 0.27; 'pm,': 0.28; 'converts': 0.29; 'received:209.85': 0.32; 'received:209.85.210': 0.32; 'received:google.com': 0.32; 'received:209': 0.35; 'two': 0.35; 'there': 0.35; 'followed': 0.35; 'but': 0.36; 'to:addr:python- list': 0.39; 'to:addr:python.org': 0.40; 'mar': 0.61; 'between': 0.64; '26,': 0.66; '2012': 0.69; "'3'": 0.84; 'subject:there': 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=43DTj8H6UzcmACUcPVDKDfy83LIbOoPUg/bv4vmvGMY=; b=J1FEF07KKp2+NCzFiDfn5dXa6UaISebYL/jFRtEL5wvaO3881rWesQEJvGTnWk9K2d m/ABkn5eObF6Jnx7Tlf9wc4IjXzIXPvo6QbKuYDqfGD+++xfGOOm6gYz3wAV1yzm8g1R YRUz4o2F3W/Ecem+ISuk8dh011I0BkXA+/5WFsAEc0I+m3l/PSAwTxjLWLYLWtdm3cSC Kb+xTHrxz/AsolFlw93zWxSb0zjBGzH5gMLTkvwnycqWoR28UGalo6bPJB1fi3vJBcAI BjoBe4LUa7Vix4OdmFH3zsN0/6oMLUMcAds/3FqasdkhHzQ26j+lN/v80vqsK4/l+Wj0 G+3w==
MIME-Version 1.0
In-Reply-To <5128580.32.1332762326119.JavaMail.geo-discussion-forums@pbom7>
References <5128580.32.1332762326119.JavaMail.geo-discussion-forums@pbom7>
Date Mon, 26 Mar 2012 23:01:40 +1100
Subject Re: Is there any difference between print 3 and print '3' in Python ?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.993.1332763303.3037.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1332763303 news.xs4all.nl 6861 [2001:888:2000:d::a6]:34978
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22177

Show key headers only | View raw


On Mon, Mar 26, 2012 at 10:45 PM,  <redstone-cold@163.com> wrote:
> 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 ?

One of them takes the integer 3, converts it into a string, and prints
it. The other takes the string '3' and prints it. There's a lot of
difference under the covers, but both will print a 3, followed by a
newline.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 04:45 -0700
  Re: Is there any difference between print 3 and print '3' in Python ? Chris Angelico <rosuav@gmail.com> - 2012-03-26 23:01 +1100
  Re: Is there any difference between print 3 and print '3' in Python ? Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 14:07 +0200
  Re: Is there any difference between print 3 and print '3' in Python ? Robert Kern <robert.kern@gmail.com> - 2012-03-26 13:10 +0100
  Re: Is there any difference between print 3 and print '3' in Python ? Dave Angel <d@davea.name> - 2012-03-26 08:11 -0400
    Re: Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 07:28 -0700
      Re: Is there any difference between print 3 and print '3' in Python ? Stefan Behnel <stefan_ml@behnel.de> - 2012-03-26 17:03 +0200
    Re: Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 07:28 -0700
    Re: Is there any difference between print 3 and print '3' in Python ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-27 03:43 +0000
      Re: Is there any difference between print 3 and print '3' in Python ? rusi <rustompmody@gmail.com> - 2012-03-26 22:00 -0700
  Re: Is there any difference between print 3 and print '3' in Python ? Terry Reedy <tjreedy@udel.edu> - 2012-03-26 11:45 -0400
  Re: Is there any difference between print 3 and print '3' in Python ? "J. Cliff Dyer" <jcd@sdf.lonestar.org> - 2012-03-26 13:06 -0400
  Re: Is there any difference between print 3 and print '3' in Python ? Peter Otten <__peter__@web.de> - 2012-03-26 19:20 +0200

csiph-web