trap.py 文件源码

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

项目:pytest-relaxed 作者: bitprophet 项目源码 文件源码
def write(self, s):
        # Ensure we always write bytes. This means that wrapped code calling
        # print(<a string object>) in Python 3 will still work. Sigh.
        if isinstance(s, six.text_type):
            s = s.encode('utf-8')
        # Write out to our capturing object & any CC's
        IO.write(self, s)
        for writer in self.cc:
            writer.write(s)

    # Dumb hack to deal with py3 expectations; real sys.std(out|err) in Py3
    # requires writing to a buffer attribute obj in some situations.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号