for i in ans: lst = [] lst.append(i[0].encode()) lst.append(i[1].encode()) print (type(lst[0])) writer.writerow(lst[0])
这个,现在依旧很迷啊!!!
PS C:\Users\Desktop\database> python total.py <class 'bytes'> Traceback (most recent call last): File "total.py", line 38, in <module> writer.writerow(lst[0]) TypeError: a bytes-like object is required, not 'str'
lst[0]就是Bytes类型啊,咋还报这个错?路过的大佬帮帮忙啊!