Windows命令行下Python交互的问题
>>> dict2={'name':'earth','port':80}
>>> for key, value in dict2.items():
... print 'key=%s,value=%s' % (key,value)
File "<stdin>", line 2
print 'key=%s,value=%s'% (key,value)
如上:怎么会出现错误呢???
>>> for key, value in dict2.items():
... print 'key=%s,value=%s' % (key,value)
File "<stdin>", line 2
print 'key=%s,value=%s'% (key,value)
如上:怎么会出现错误呢???
作者: heartiner 发布时间: 2011-05-29
Python code
>>> dict2.items() [('name', 'earth'), ('port', 80)] >>> for i in dict2.items(): print i ('name', 'earth') ('port', 80) >>> for key in dict2: print key,dict2[key] name earth port 80 >>>
作者: a590687 发布时间: 2011-05-29