반응형
[Python] 파이썬 TypeError: string indices must be integers 에러 원인 및 해결 방법 !!
TypeError: string indices must be integers 에러의 원인은
인덱스 값이 정수가 아닌 경우 일때 발생하는 에러입니다.
EX)
>>> a = 1
>>> hello[a]
'h'
>>> hello[a+1]
'e'
>>> hello[1.5]
TypeError: string indices must be integers
결론은 인덱스값을 정수로 바꾸면 에러가 해결 됩니다 :)
728x90
반응형
'Coding > Python' 카테고리의 다른 글
[Python & Django] 장고 사용 중 You are trying to add a non-nullable field '필드명' to post without a default 해결 방법 (0) | 2022.10.02 |
---|---|
[Python] 초간단 파이썬 소수점 자리수 반올림 하는 방법 !! (0) | 2022.08.18 |
[Python] 셀레니움(Selenium) Element 텍스트 읽기 & 가져오기 ! (2) | 2022.07.07 |
[Python] 셀레니움(Selenium) 페이지 스크롤 기능 만들기 ! (0) | 2022.07.01 |
이미지 & 사진 크롤링(Crawling) 프로그램 - 원하는 사진 한번에 다운 받기! (0) | 2022.06.22 |
댓글