【发布时间】:2014-03-21 22:22:17
【问题描述】:
这被证明是向 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()
输出文件如下所示:
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
【问题讨论】:
-
解码明文或编码换行符。
标签: python