我有一个错误使用这个,我不明白
import glob
import zlib
import sys
for filename in sys.argv:
with open(filename, 'r') as compressed:
with open(filename + "-decompressed', 'w') as expanded:
data = zlib.decompress(compressed.read())
expanded.write(data)
错误
with open(filename + "-decompressed', 'w') as expanded:
^
SyntaxError: EOL while scanning string literal
TY
答案 0 :(得分:0)
您偶然使用一个双引号和一个单引号来关闭字符串。应该是
with open(filename + '-decompressed', 'w') as expanded: