Hey, I tried to run this code:
import csv
isbn_list = []
with open("books.csv") as books_csv:
books_reader = csv.DictReader(books_csv, delimiter='@')
for each in books_reader:
isbn_list.append[each["ISBN"]]
But I’m getting an error: TypeError: 'builtin_function_or_method' object is not subscriptable
Why does the error appear here, if it doesn’t appear in case of this code:
(SOLUTION CODE):
import csv
with open('books.csv') as books_csv:
books_reader = csv.DictReader(books_csv, delimiter='@')
isbn_list = [book['ISBN'] for book in books_reader]
It’s really confusing why I accent elements to that list, even thought I am reffering to the very same elements in the loop.