例如:
with io.open('Example.txt','r',encoding='utf-8') as temp:
ExampleText=temp.readlines()[1]
Run Code Online (Sandbox Code Playgroud)
我是否需要手动关闭它,例如:
with io.open('Example.txt','r',encoding='utf-8') as temp:
ExampleText=temp.readlines()[1]
temp.close()
Run Code Online (Sandbox Code Playgroud)