這被證明是一個粗略的轉換到python。這是怎麼回事?:上不能連接字節到str
f = open('myfile', 'a+')
f.write('test string' + '\n')
key = "pass:hello"
plaintext = subprocess.check_output(['openssl', 'aes-128-cbc', '-d', '-in', test, '-base64', '-pass', key])
print (plaintext)
f.write (plaintext + '\n')
f.close()
輸出文件看起來像:
test string
,然後我得到這個錯誤:
b'decryption successful\n'
Traceback (most recent call last):
File ".../Project.py", line 36, in <module>
f.write (plaintext + '\n')
TypeError: can't concat bytes to str
解碼你的明文或編碼的換行符。 – Hyperboreus