这证明转向Python是一个艰难的过程。这里发生了什么?:
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()
输出文件看起来像这样:
测试字符串
然后我得到了这个错误:
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