首页 > 技术文章 > python 输出字符串如果遇到字典

ghgyj 2014-09-28 02:35 原文

>>> d = {'a':1}
>>> print '%s' % 1,d
1 {'a': 1}
>>> print '%s %s' % 1,d
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not enough arguments for format string

 

推荐阅读