我有一个函数创建了一个叫做a()
的字典,并且它需要参数params
。我想要打印这个字典,所以我使用了pprint:
dict=a(params)
pprint(dict)
pprint 给我返回了这个错误:
TypeError: 'module' object is not callable
但是打印正常!
我有一个函数创建了一个叫做a()
的字典,并且它需要参数params
。我想要打印这个字典,所以我使用了pprint:
dict=a(params)
pprint(dict)
pprint 给我返回了这个错误:
TypeError: 'module' object is not callable
但是打印正常!
pprint
的?如果你没有指定从 pprint
导入什么,当调用时需要使用模块名称。import pprint
pprint.pprint(...)
或者您可以导入特定的方法。
from pprint import pprint
pprint(...)