How to solve the problem of File Encoding in python Reading

stephen@ubuntu:~/qichacha$ python3 qichacha.py 
Traceback (most recent call last):
  File "qichacha.py", line 286, in <module>
    qichacha().read_data()
  File "qichacha.py", line 71, in read_data
    str = f.read()
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: "utf-8" codec can"t decode byte 0xd0 in position 0: invalid continuation byte

clipboard.png

Mar.21,2021

it should be a mistake to save the content containing bom with txt.
method 1:
Open the web page, copy the content, and post it in the notepadPP that is set to utf-8.
method 2:

import codecs
str = f.read()
if str[:3] == codecs.BOM_UTF8:
    str = str[3:]

use the heart's str for operations

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39dfc-34596.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39dfc-34596.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?