Screen Link:
https://app.dataquest.io/c/79/m/452/reading-and-writing-to-files/6/encoding-identification-workflow
I am confused with these different notations to read the file. Can Someone explain why we are using different syntactical notations to read the file?
import csv,chardet
with open('kyoto_restaurants.csv',mode ='rb') as file:
raw_bytes = file.read(3)
encoding_name = chardet.detect(raw_bytes)['encoding']
print(encoding_name)
with open('kyoto_restaurants.csv', encoding = encoding_name) as file:
rows = list(csv.reader(file))