資料整理問題
2019/11/23 03:25 下午
Python網路爬蟲討論版
zero0827z
觀看數:7
回答數:3
收藏數:0
pycrawler
pycrawler-d03
我在使用xmltodict時,要從location往下到weatherElement時,會出現此格式不可以為文字格式,所以無法再往下細分出時間與溫度,
想詢問是否我哪裡有做錯?
code:
data=d['cwbopendata']['dataset']['locations']['location']['weatherElement']
log:
TypeError Traceback (most recent call last) <ipython-input-189-aad7c070e8aa> in <module> 1# 2. 請取出每一個地區所記錄的第一個時間點跟溫度----> 2data=d['cwbopendata']['dataset']['locations']['location']['weatherElement']TypeError: list indices must be integers or slices, not str