Python TypeError:"bytes"对象不能解释为整数。如何添加"字节"?



当我使用保存时,我得到了一个错误TypeError: 'bytes' object cannot be interpreted as an integer,该怎么做才能使它正确?

我想保存在同一张图片中,而不是创建一个新的。

from iptcinfo3 import IPTCInfo
import sys
imagename = 'horse.jpg'
info = IPTCInfo(imagename)
info['keywords'] = 'horse', 'brown', 'animal', 'nature'
info.save()

如何添加'bytes'?文档什么都没说?

我以前没有使用过这个特定的包,但我相信关键字应该是一个python列表(我可能错了)

你试过像这样在关键字周围加方括号吗?

from iptcinfo3 import IPTCInfo
import sys
imagename = 'horse.jpg'
info = IPTCInfo(imagename)
info['keywords'] = ['horse', 'brown', 'animal', 'nature']
info.save()

最新更新