Given the information as follows
Code is given below
The reason given
Coding and encoding the file read the entire file is not set Python
solution
The first line sets
# _*_ coding:utf-8 _*_
Open the txt file to set the encoding format
open("data.txt",'r',encoding='UTF-8')