[python error] : _csv.reader' object is not subscriptable

2020. 6. 21. 12:27·Error code 모음/4. Python errors
반응형

위 에러는 csv 라이브러리를 사용할 때 

나타날 수 있는 에러이다.

 

이 에러는 csv reader 가 인덱싱을 서포트 하지 못하여 

csv.reader 값을 리턴할 수가 없는 것이다. 

 

 ## spotify searchAPI
    artists = []
    with open('./artist_list.csv', encoding='utf8') as f:
        raw = csv.reader(f)
        for row in raw:
            artists.append(row[0])
 ## row[0] 을 raw[0] 으로 썼었음..

 

나의 경우에는 오타때문에 위 에러가 나타났지만,

평상시에는 rows 를 리스트 안에 넣어줌으로써 해결 할 수 있는 에러 같다.

 

참고 링크

https://stackoverflow.com/questions/32038776/csv-reader-object-is-not-subscriptable

 

_csv.reader' object is not subscriptable

I have a problem with the csv module in python. This is the code I've written to parse my csv def parse(data): data_delim = data.split("\n") data_list = csv.reader(data_delim) return

stackoverflow.com

 

반응형

'Error code 모음 > 4. Python errors' 카테고리의 다른 글

[Python Error] 'charmap' codec can't encode character '\xe3' in position 1: character maps to <undefined>  (0) 2020.10.31
[python error] ImportError: cannot import name 'abc' from 'bson.py3compat'  (0) 2020.09.05
python error : list indices must be integers or slices, not str  (0) 2020.05.23
python error: Could not import the lzma module. Your installed Python is incomplete.  (0) 2020.04.08
python error: do_this( ) takes 1 positional argument but 15 were given  (0) 2020.03.18
'Error code 모음/4. Python errors' 카테고리의 다른 글
  • [Python Error] 'charmap' codec can't encode character '\xe3' in position 1: character maps to <undefined>
  • [python error] ImportError: cannot import name 'abc' from 'bson.py3compat'
  • python error : list indices must be integers or slices, not str
  • python error: Could not import the lzma module. Your installed Python is incomplete.
쟈누
쟈누
Ad astra per aspera
    반응형
  • 쟈누
    쟈누의 기록공간
    쟈누
  • 전체
    오늘
    어제
    • 분류 전체보기 (444)
      • AWS (31)
        • Glue (4)
        • S3 (1)
      • 클라우드 (0)
      • Data Engineering (37)
        • GitHub (10)
        • NiFi (11)
        • Spark (10)
        • Snowflake (0)
        • 머신러닝, AI (6)
      • 언어 (118)
        • 데이터 베이스 (42)
        • JAVA (9)
        • Python (34)
        • Java Script (15)
        • Linux (18)
      • 프로젝트, 인강 그리고 책 (30)
        • Spotify Project (7)
        • RASA chatbot Project (9)
        • Naver shopping Project (6)
        • 빅데이터를 지탱하는 기술 (8)
      • OLD (56)
        • IT 용어 사전 (13)
        • Front End (12)
        • Back End (31)
      • Error code 모음 (165)
        • 1. SQL errors (17)
        • 2. Hadoop errors (20)
        • 3. Linux Errors (14)
        • 4. Python errors (33)
        • 5. JAVA, Spring errors (41)
        • 6. Jav Script errors (10)
        • 7. Dev Tools errors (9)
        • 8. Git errors (8)
        • 9. Jenkins Errors (4)
        • 10. airflow Errors (2)
        • 11. Aws errors (7)
      • 개인 (1)
        • 책 (1)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 블로그 관리
    • 글쓰기
  • 링크

  • 공지사항

    • 간단한 블로그 소개
  • 인기 글

  • 태그

    API
    Python
    error
    node
    Spring
    NiFi
    Git
    자바
    java
    설치
    SQL
    json
    리눅스
    python error
    install
    MySQL
    파이썬
    AWS
    linux
    에러
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
쟈누
[python error] : _csv.reader' object is not subscriptable
상단으로

티스토리툴바