Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'subject:Python': 0.05; 'none,': 0.05; 'assign': 0.07; 'completeness': 0.07; 'expressions': 0.07; 'python': 0.09; 'dict': 0.09; 'received:155': 0.09; 'repr': 0.09; 'created.': 0.16; 'debugger,': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'is",': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:169.70.184.72': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:hubcr105.exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'repr()': 0.16; 'securities,': 0.16; 'shell:': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'shell': 0.18; 'to:name:python-list@python.org': 0.20; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'accuracy': 0.27; 'dictionary': 0.29; 'prints': 0.29; 'received:169': 0.29; 'header:Received:8': 0.30; 'code': 0.31; 'print': 0.32; 'like:': 0.33; 'to:addr:python-list': 0.33; 'subject:?': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'anywhere.': 0.84; 'received:169.254.8': 0.84 X-DKIM: OpenDKIM Filter v2.1.3 sz2.jpmchase.com q71FR1n6012303 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1343834821; bh=cYPQTZ6iS+WRwmI5Oz5XALgLIwIHWz6ZsLNV0kY5xuE=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=JNOE1QxUabNSg/4uN7et2YkJbhV/raptVhNpyAcBYtxHPG9qqJweQSupr0uGIXo6O ZG4qhyxoEhgiOQX3IhgagM4beRQrTplkxFS/BGZACDzMc23PzSjzf5F6Psdl0qxJip N+wS4Yw5XZasqjMql0/4OaHx1ckte3ZQZfSBBhSY= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: why the different output in Eclipse and Python Shell? Thread-Topic: why the different output in Eclipse and Python Shell? Thread-Index: AQHNb6B9C2Er9lrCNEqqsDXIzZhy75dE/siAgAAUkLA= Date: Wed, 1 Aug 2012 15:26:40 +0000 References: <5018FFEF.3000203@davea.name> In-Reply-To: <5018FFEF.3000203@davea.name> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343834830 news.xs4all.nl 6870 [2001:888:2000:d::a6]:37907 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26366 > > my code in Eclipse:=0D=0A> >=0D=0A> > dict=2Efromkeys(['China','America= '])=0D=0A> > print "dict is",dict=0D=0A> >=0D=0A> > output: dict is =0D=0A> >=0D=0A> > my code in Python Shell:=0D=0A> >=0D=0A> > dict=2E= fromkeys(['China','America'])=0D=0A> >=0D=0A> > output:{'America': None, 'C= hina': None}=0D=0A> >=0D=0A> > Output in Python Shell is what i wanna,but w= hy not in Eclipse?=0D=0A> >=0D=0A> >=0D=0A> =0D=0A> The Python Shell is an = interactive debugger, and prints the repr() of=0D=0A> expressions that you = don't assign anywhere=2E I don't know Eclipse, but I=0D=0A> suspect what y= ou want to do is something like:=0D=0A> =0D=0A> print "dict is", repr(dict)= =0D=0A=0D=0AI think you mean=0D=0Aprint "dict is", repr(dict=2Efromkeys(['C= hina','America']))=0D=0A=0D=0AOtherwise you are just printing the repr of t= he dict type=0D=0Aand not the dictionary created=2E I would really store th= e output and=0D=0Athen print it=2E=0D=0A=0D=0Ad =3D dict=2Efromkeys(['China= ','America'])=0D=0Aprint "dict is", d=0D=0A=0D=0ARamit=0D=0A=0D=0AThis emai= l is confidential and subject to important disclaimers and=0D=0Aconditions = including on offers for the purchase or sale of=0D=0Asecurities, accuracy a= nd completeness of information, viruses,=0D=0Aconfidentiality, legal privil= ege, and legal entity disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan= =2Ecom/pages/disclosures/email=2E