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 -- http://mail.python.org/mailman/listinfo/python-list