Python 3.x 为什么可以';我在python脚本中使用ppprint吗
我目前正在编写python脚本,出现以下错误: “所有者”:“python”, “代码”:“模块中没有名称”, “严重性”:8, “消息”:“模块'ppprint'中没有名称'ppprint'” 这是我的密码:Python 3.x 为什么可以';我在python脚本中使用ppprint吗,python-3.x,Python 3.x,我目前正在编写python脚本,出现以下错误: “所有者”:“python”, “代码”:“模块中没有名称”, “严重性”:8, “消息”:“模块'ppprint'中没有名称'ppprint'” 这是我的密码: import requests # To make get and post requests to APIs import json # To deal with json responses to APIs from ppprint import ppprint # To p
import requests # To make get and post requests to APIs
import json # To deal with json responses to APIs
from ppprint import ppprint # To pretty print json info in a more readable format
您需要正确导入
pprint
(包含在python标准库中):
或者像下面的代码
import requests # To make get and post requests to APIs
import json # To deal with json responses to APIs
from pprint import pprint # To pretty print json info in a more readable format
你想打印什么东西吗…??pprint是打字错误。它叫
pprint
,不是pprint
@MuhammadRizwanMunawar是的,实际上我正在尝试运行我的第一个API请求。当然,我回答了,请检查。谢谢,伙计!我意识到是小姐写的。好的,当然可以@DoubleH
import requests # To make get and post requests to APIs
import json # To deal with json responses to APIs
from pprint import pprint # To pretty print json info in a more readable format