python configparser库 UnicodeDecodeError: 'gbk' codec can't decode byte 解决办法

UnicodeDecodeError: 'gbk' codec can't decode byte

将 File "D:\ProgramData\Anaconda3\lib\configparser.py"文件中的 read(self, filenames, encoding=none): 改为

def read(self, filenames, encoding="utf-8"):
    """Read and parse a filename or an iterable of filenames.

    Files that cannot be opened are silently ignored; this is
    designed so that you can specify an iterable of potential
    configuration file locations (e.g. current directory, user's
    home directory, systemwide directory), and all existing
    configuration files in the iterable will be read.  A single
    filename may also be given.

    Return list of successfully read files.
    """
posted @ 2022-01-25 21:32  alphacheng  阅读(496)  评论(0编辑  收藏  举报