1.The print
statement has been replaced with a print()
function, with keyword arguments to replace most of the special syntax of the old print
statement (PEP 3105).
2.
dict
Fixes dictionary iteration methods. dict.iteritems()
is converted to dict.items()
, dict.iterkeys()
to dict.keys()
, and dict.itervalues()
todict.values()
. Similarly, dict.viewitems()
, dict.viewkeys()
and dict.viewvalues()
are converted respectively to dict.items()
, dict.keys()
anddict.values()
. It also wraps existing usages of dict.items()
, dict.keys()
, and dict.values()
in a call to list
.
20180401 Ken:
Python3.6.4中:
list(dict.keys())[0] 可用,dict.keys()[0]不可用
3.PEP 3111: raw_input()
was renamed to input()
. That is, the new input()
function reads a line from sys.stdin
and returns it with the trailing
4. if type(secondDict[key])==dict:#可以用下面语句替换
#if isinstance(secondDict[key],dict):
'''Pthon3.6.4中已不适用如下方法
if type(secondDict[key])._name_=='dict':