《Python编程从入门到实践》实战项目二17.2.3引发如下错误
AttributeError:'NoneType' object has no attribute 'decode'
造成原因应该是web api信息缺失引发错误了,比如部分项目的描述信息,可考虑用if-else代码块解决
#探索有关仓库的信息
repo_dicts =response_dict['items']
names,plot_dicts = [],[]
for repo_dict
在执行《Python编程从入门到实践》的实战项目时遇到17.2.3错误,该错误源于web API返回的数据缺失,导致尝试对None对象调用'decode'方法。解决方案是通过if-else语句检查数据是否存在,避免对None对象进行不必要的操作。
《Python编程从入门到实践》实战项目二17.2.3引发如下错误
AttributeError:'NoneType' object has no attribute 'decode'
造成原因应该是web api信息缺失引发错误了,比如部分项目的描述信息,可考虑用if-else代码块解决
#探索有关仓库的信息
repo_dicts =response_dict['items']
names,plot_dicts = [],[]
for repo_dict
515
1394
3084

被折叠的 条评论
为什么被折叠?