python can i use return in wiht statement?

with open(file_name) as obj:
for i in obj:
if i != ”:
return True
在with语句中使用返回值是可以的吗?文件对象是否得到了正常的关闭?

posted @ 2022-03-06 10:39  叶常落  阅读(25)  评论(0)    收藏  举报