标签: python python-3.x
我有这段代码:
features_dict = json.load(open(features_path))
我想知道我的文件在执行后保持打开状态还是自动关闭?
答案 0 :(得分:2)
文件保持打开状态,您需要将其关闭或使用with open,超出范围后它将自动关闭:
with open
with open ('features_path','r') as features_path: #Do stuff