我正试图从JSON文件中提取数据,我仍然不清楚错误的到来。我的数据如下:
"Tracker"{"2021年9月30日,":{"DC" 4,"DN":"0:0",
DC = {}
for day, daily_data in read_content['Tracker'].items():
for value in daily_data['Disturbances Count']:
DC[datetime] = value
我得到以下错误
---------------------------------------------------------------------------
TypeError: 'int' object is not iterable
以上代码的解决方案仅为添加str
DC = {}
for day, daily_data in read_content['Tracker'].items():
for value in str(daily_data['Disturbances ']):
DC[datetime] = value