1 Star 0 Fork 0

Coing/code-sample

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
with_example01.py 331 Bytes
一键复制 编辑 原始数据 按行查看 历史
Coing 提交于 2016-04-09 18:18 +08:00 . add python with using
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Sample:
def __enter__(self):
print("In__enter__()")
return "FOO"
def __exit__(self, exc_type, exc_val, exc_tb):
print("In __exit__()")
def get_sample():
return Sample()
with get_sample() as sample_out:
print("sample_out:", sample_out)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Coing/code-sample.git
git@gitee.com:Coing/code-sample.git
Coing
code-sample
code-sample
master

搜索帮助