Skip to content

2장. p. 83, In [7] 에러가 반복되네요. #96

@hunyul68

Description

@hunyul68

다음과 같이 에러가 나오네요.

[In]
station_addreess = []
station_lat = []
station_lng = []

for name in station_name:
tmp = gmaps.geocode(name, language='ko')
station_addreess.append(tmp[0].get("formatted_address"))

tmp_loc = tmp[0].get("geometry")

station_lat.append(tmp_loc['location']['lat'])
station_lng.append(tmp_loc['location']['lng'])

print(name + '-->' + tmp[0].get("formatted_address"))

[Out]
서울중부경찰서-->대한민국 서울특별시 중구 수표로 27
서울종로경찰서-->대한민국 서울특별시 종로구 종로1.2.3.4가동 율곡로 46
서울남대문경찰서-->대한민국 서울특별시 중구 한강대로 410
서울서대문경찰서-->대한민국 서울특별시 서대문구 통일로 113
서울혜화경찰서-->대한민국 서울특별시 종로구 창경궁로 112-16
서울용산경찰서-->대한민국 서울특별시 용산구 백범로 329
서울성북경찰서-->대한민국 서울특별시 성북구 삼선동 보문로 170
서울동대문경찰서-->대한민국 서울특별시 동대문구 약령시로21길 29
서울마포경찰서-->대한민국 서울특별시 마포구 마포대로 183
서울영등포경찰서-->대한민국 서울특별시 영등포구 당산동3가 국회대로 608
서울성동경찰서-->대한민국 서울특별시 성동구 행당동 왕십리광장로 9
서울동작경찰서-->대한민국 서울특별시 동작구 노량진로 148
서울광진경찰서-->대한민국 서울특별시 광진구 구의동 자양로 167
서울서부경찰서-->대한민국 서울특별시 은평구 녹번동 177-15
서울강북경찰서-->대한민국 서울특별시 강북구 오패산로 406
서울금천경찰서-->대한민국 서울특별시 금천구 시흥대로73길 50
서울중랑경찰서-->대한민국 서울특별시 중랑구 묵2동 249-2
서울강남경찰서-->대한민국 서울특별시 강남구 테헤란로114길 11
서울관악경찰서-->대한민국 서울특별시 관악구 관악로5길 33
서울강서경찰서-->대한민국 서울특별시 강서구 화곡6동 980-27
서울강동경찰서-->대한민국 서울특별시 강동구 성내로 57

IndexError Traceback (most recent call last)
in ()
5 for name in station_name:
6 tmp = gmaps.geocode(name, language='ko')
----> 7 station_addreess.append(tmp[0].get("formatted_address"))
8
9 tmp_loc = tmp[0].get("geometry")

IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions