问题:csv.Error: iterator should return strings, not bytes

    科技2025-04-22  9

    原始的代码:

    with open('HEC.csv', 'rb') as file: reader = csv.DictReader(file) thpDict = [thp for thp in reader] print(str(thpDict))

    修改后的代码

    with open('HEC.csv', 'r',encoding="utf-8") as file: reader = csv.DictReader(file) thpDict = [thp for thp in reader] print(str(thpDict))

     

    Processed: 0.008, SQL: 8