Opening a file code not working on jupyter

Screen Link:

My Code:

opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)

What I expected to happen:

What actually happened:

<_io.TextIOWrapper name='AppleStore.csv' mode='r' encoding='cp1252'>
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-1-54992d0f48cb> in <module>
      3 read_file = reader(opened_file)
      4 print(opened_file)
----> 5 apps_data = list(read_file)

~\anaconda3\lib\encodings\ in decode(self, input, final)
     21 class IncrementalDecoder(codecs.IncrementalDecoder):
     22     def decode(self, input, final=False):
---> 23         return codecs.charmap_decode(input,self.errors,decoding_table)[0]
     25 class StreamWriter(Codec,codecs.StreamWriter):

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 8066: character maps to <undefined>

Hi @soumyachatty,

Welcome to the Community!

It can help adding the encoding utf8 to your open() function:

opened_file = open('AppleStore.csv', encoding='utf8')

Thank You @Elena_Kosourova.

1 Like