mozillazg's Blog
  • Feed
  • About
  • Archives

[python]返回一个空的生成器

2013-08-15

python Tags python / generator
  • 参考

如何返回一个空的生成器:

>>> def foo():
...     return
...     yield
...
>>> foo()
<generator object foo at 0x01C46968>
>>> list(foo())
[]
>>>

参考

  • Python Empty Generator Function - Stack Overflow

微信扫一扫:分享

Scan me!

微信里点“发现”,扫一下

二维码便可将本文分享至朋友圈。

有任何建议和想法欢迎在下方评论区留言或者加我微信交流

Related Posts:

  • 如何在 centos 7 上编译 boost
  • 使用 mitmproxy 搭建代理服务器的方式来调试微信开发
  • Flask-SQLAlchemy 执行 exclude 查询
  • [django]通过自定义 Model Field 的方式将上传的文本文件按 UTF-8 编码保存
  • [python]如何生成一个 Unicode 编码的文件

Comments


© 2025 mozillazg · Powered by pelican-bootstrap3, Pelican, Bootstrap · Privacy

Creative Commons License "mozillazg's Blog" by mozillazg is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, except where indicated otherwise.

Back to top