{รหัสเมือง: {'list': [ {'dt_txt' : วันเวลา, 'weather': [รหัสสภาพอากาศ, รหัสสภาพอากาศ, ...]}, {'dt_txt' : วันเวลา, 'weather': [รหัสสภาพอากาศ, รหัสสภาพอากาศ, ...]}, ... ], 'name ': ชื่อเมือง 'region': ชื่อย่อภาค }, รหัสเมือง: {... }, ... } def f(d): out = {} # {วันเวลา: {รหัสภาพอากาศ}, ...} for _,v in d: for e in v['list']: t = e['dt_txt'] if t not in out: out[t] = set() out[t] |= set(e['weather']) return out def f(d): out = {} # {รหัสสภาพอากาศ: {วันเวลาต่าง ๆ}, ...} for _,v in d: for e in v['list']: for c in e['weather']: if c not in out: out[c] = set() c.add(e['dt_txt']) return out def f(d): out = {} # {รหัสสภาพอากาศ: {ชื่อเมื่องต่าง ๆ}, ...} for _,v in d: for e in v['list']: for c in e['weather']: if c not in out: out[c] = set() c.add(v['name']) return out def f(d): out = {} # {รหัสสภาพอากาศ: {รหัสเมื่องต่าง ๆ}, ...} for cid,v in d: for e in v['list']: for c in e['weather']: if c not in out: out[c] = set() c.add(cid) return out def f(d): out = {} # {รหัสสภาพอากาศ: {ชื่อย่อภาคต่าง ๆ}, ...} for cid,v in d: for e in v['list']: for c in e['weather']: if c not in out: out[c] = set() c.add(v['region']) return out def f(d): out = {} # {ชื่อย่อภาค: {รหัสสภาพอากาศต่าง ๆ}, ...} for cid,v in d: r = v['region'] if r not in out: out[r] = set() for e in v['list']: out[r] |= set(e['weather']) return out