小编Raj*_*Raj的帖子

Python抛出"'utf8'编解码器无法解码位置0中的字节0xd0"错误

我正在尝试加载当前存在的工作表并导入下面显示的文本文件(逗号分隔值)截图,

Excel表格:

在此输入图像描述

文本文件:

在此输入图像描述

我使用下面显示的代码:

# importing necessary modules for performing the required operation
    import glob
    import csv
    from openpyxl import load_workbook
    import xlwt

    #read the text file(s) using the CSV modules and read the dilimiters and quoutechar
    for filename in glob.glob("E:\Scripting_Test\Phase1\*.txt"):
        spamReader = csv.reader((open(filename, 'rb')), delimiter=',')


        #read the excel file and using xlwt modules and set the active sheet
        wb = load_workbook(filename=r"E:\Scripting_Test\SeqTem\Seq0001.xls")
        ws = wb.worksheets(0)


        #write the data that is in text file to excel file
        for rowx, row in …
Run Code Online (Sandbox Code Playgroud)

excel text python-2.7 openpyxl

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

excel ×1

openpyxl ×1

python-2.7 ×1

text ×1