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


Groups > comp.lang.python > #26341 > unrolled thread

Re: why the different output in Eclipse and Python Shell?

Started byDave Angel <d@davea.name>
First post2012-08-01 06:07 -0400
Last post2012-08-01 06:07 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: why the different output in Eclipse and Python Shell? Dave Angel <d@davea.name> - 2012-08-01 06:07 -0400

#26341 — Re: why the different output in Eclipse and Python Shell?

FromDave Angel <d@davea.name>
Date2012-08-01 06:07 -0400
SubjectRe: why the different output in Eclipse and Python Shell?
Message-ID<mailman.2812.1343815671.4697.python-list@python.org>
On 08/01/2012 12:45 AM, levi nie wrote:
> my code in Eclipse:
>
> dict.fromkeys(['China','America'])
> print "dict is",dict
>
> output: dict is <type 'dict'>
>
> my code in Python Shell:
>
> dict.fromkeys(['China','America'])
>
> output:{'America': None, 'China': None}
>
> Output in Python Shell is what i wanna,but why not in Eclipse?
>
>

The Python Shell is an interactive debugger, and prints the repr() of
expressions that you don't assign anywhere.  I don't know Eclipse, but I
suspect what you want to do is something like:

print "dict is", repr(dict)



-- 

DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web