37,720
社区成员
发帖
与我相关
我的任务
分享
b={'name':'abc',address:'xyz'}
print 'hello %(name)' % b
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-92-bc9585e20f74> in <module>()
----> 1 'hello %(name)' % b
b={'name':'abc','address':'xyz'}
print 'hello %s' % b['name']
方法二:
b={'name':'abc','address':'xyz'}
print 'hello %(name)s' % b
b={'name':'abc','address':'xyz'}
print('hello %s' % b['name'])
参考:python 输入输出