py3 execfile实现
def execfile(file_path, globals=None, locals=None):
if globals is None:
globals = {}
globals.update({
"__file__": file_path,
"__name__": "__main__",
})
with open(file_path, 'rb') as file:
exec(compile(file.read(), file_path, 'exec'), globals, locals)


浙公网安备 33010602011771号