现在我使用的是:
pageHeadSectionFile = open('pagehead.section.htm','r') output = pageHeadSectionFile.read() pageHeadSectionFile.close()
但为了使代码更美观,我可以这样做:
output = open('pagehead.section.htm','r').read()
当使用上述语法时,我如何关闭文件以释放系统资源?
用户名或电子邮箱地址
密码