이 구조를 보고
item = r['response']['body']['tableList']['0']['items']['item']
이렇게 입력했을 때는 TypeError: list indices must be integers or slices, not str 이런 오류가 뜨고,
item = r['response']['body']['tableList']까지만 입력하면 오류가 뜨지 않지만, 아래에 테이블을 만드는 코드를 입력할 때 아래 사진처럼 각각의 응답 메시지 항목을 찾을 수 없다고 뜹니다.
tablelist 다음이 list라서 ['0']이 아니라 [0]로 index 처리 해야 합니다.
json viewer에서 대괄호[ ]와 중괄호{ }의 차이를 자세히 보면 보일 것입니다.
items = r['response']['body']['tableList'][0]['items']['item']
제가 선택한 API URL을 JSON Viewer로 봤을 때 아래 사진과 같이 보입니다.
이 구조를 보고![image](https://user-images.githubusercontent.com/101347540/161507261-ac4156c8-b83f-4cdb-872d-4e67deae43c2.png)
item = r['response']['body']['tableList']['0']['items']['item']
이렇게 입력했을 때는 TypeError: list indices must be integers or slices, not str 이런 오류가 뜨고,item = r['response']['body']['tableList']
까지만 입력하면 오류가 뜨지 않지만, 아래에 테이블을 만드는 코드를 입력할 때 아래 사진처럼 각각의 응답 메시지 항목을 찾을 수 없다고 뜹니다.이런 경우 item =r 이후 어떻게 입력해야 하나요?