python - _csv.reader' object is not subscriptable -


i have problem csv module in python.

this code i've written parse csv

def parse(data):     data_delim = data.split("\n")     data_list = csv.reader(data_delim)     return data_list 

the problem encountering following:

print(data_list[enum.check_name(skill)][1]) 

throws error

_csv.reader' object not subscriptable 

i have ghetto solution below, i'd rather use similar code above, have solution this?

i = 0 in data_list:     if == enum.check_name(skill):         print(a[1])     += 1 

as error message says, csv readers don't support indexing. value returned csv.reader not list; it's iterator on rows.

if want, make list of rows data_list = list(csv.reader(data_delim)). can index list other.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -