coroutine.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:taf 作者: taf3 项目源码 文件源码
def file_output(file_object):
    """
    Writes strings to a file, making sure there's a newline at the end

    :param:

     - `file_object`: opened, writable file or name of file to open
    """
    from io import IOBase
    if not isinstance(file_object, IOBase):
        file_object = open(file_object, WRITEABLE)
    while True:
        line = (yield)
        line = line.rstrip(NEWLINE) + NEWLINE
        file_object.write(line)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号