我正在尝试使用以下python脚本提取.zip文件,但是我收到以下错误。
SyntaxError: invalid syntax
代码如下:
>>> import zipfile
>>> import os
>>> source_dir = "c:\\TEST"
>>> dest_dir = "c:\\TEST"
>>> for src_name in glob.glob(os.path.join(source_dir, '*.zip')):
... base = os.path.basename(src_name)
... dest_name = os.path.join(dest_dir, base[:-4])
... with zipfile.Zipfile((src_name, 'r') as infile:
File "<stdin>", line 4
with zipfile.Zipfile((src_name, 'r') as infile:
^
SyntaxError: invalid syntax
>>>
答案 0 :(得分:1)
你与括号不匹配