请问下面这个python报错要怎么解决,需要如何去定义初始化这个america?
收起
你if判断都没有成立,america没有创建if topcountry[i]["name"] == '上海': america = topcountry[i]
你循环中所有 topcountry[i]["name"] 都不等于 '上海':一直没有执行 america = topcountry[i]
america 就是未定义
报告相同问题?