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類型啊,咋還報這個錯?路過的大佬幫幫忙啊!