我想将.txt文件隐藏到图片中,但是我不想使用stegano,因为我已经使用过它,如果再次使用stegano,它将覆盖数据。所以我想使用How do I hide a file inside an image with Python?
而且我尝试使用该问题的答案
out=file("makan.png","wb")
out.write(file("sudah.png","rb").read())
out.write(file("cipher.txt","rb").read())
out.close()
但它表示文件未定义,有人可以解释吗?我是python的初学者,很抱歉
只需将file
替换为open
。另外,您可以使用with
,因此您无需在结尾处调用close
:
with open('makan.png', 'wb') as out:
out.write(open('sudah.png', 'rb').read())
out.write(open('cipher.txt', 'rb').read())