代码是:
import sys
execfile('test.py')
Run Code Online (Sandbox Code Playgroud)
在test.py我有:
import zipfile
with zipfile.ZipFile('test.jar', 'r') as z:
z.extractall("C:\testfolder")
Run Code Online (Sandbox Code Playgroud)
此代码生成:
AttributeError ( ZipFile instance has no attribute '__exit__' ) # edited
Run Code Online (Sandbox Code Playgroud)
从python idle运行时,"test.py"中的代码有效.我正在运行python v2.7.10