with open((item[1], 'wb'), encoding='utf-8') as imge1:
rttd = imge1.write()
print(rttd)
我正在尝试访问此文件,但我不知道该怎么做,我尝试在“ with open”行之外使用解码和编码来尝试摆脱元组,但随后出现unicode错误。下面是我在上面编写此代码时的错误
TypeError: expected str, bytes or os.PathLike object, not tuple in Python
答案 0 :(得分:1)
在open((item[1], 'wb'), encoding='utf-8')
中,参数0和1在元组内部(例如,G。(1、2、3))。请改为使用open(item[1], 'wb', encoding='utf-8')