洛阳直播网站建设/网络推广软文怎么写
with open(json_file, 'r') as f:data = json.load(f)
要写个简单的数据处理脚本,报错AttributeError: ‘str’ object has no attribute ‘load’,查看了一下,路径正确,查了半天博客,不知道错在哪里。
回头一看
jsons_path = r"路径"
images_path = r"路径"
output_folder = r'路径'
for json in os.listdir(jsons_path):if json.endswith('.json'):json_path = os.path.join(jsons_path, json)
函数外面循环中的全局变量命名为json,循环中进入了报错的函数。
改个名字就好了
我是大sb