该文被密码保护。 阅读全文
posted @ 2020-06-24 17:28 Alrenn 阅读(0) 评论(0) 推荐(0)
摘要: 上下文管理 文件IO操作可以对文件对象使用上下文管理,使用with...as语法。 with open('test','w+') as f: f.write('abc') 仿照上例写一个自己的类,实现上下文管理 class Point: pass def __enter__(self): pass 阅读全文
posted @ 2020-06-24 09:01 Alrenn 阅读(156) 评论(0) 推荐(0)