__init__.py 文件源码

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

项目:deb-python-traceback2 作者: openstack 项目源码 文件源码
def format(self):
        """Format the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.
        """
        result = []
        for frame in self:
            row = []
            row.append(u('  File "{0}", line {1}, in {2}\n').format(
                _some_fs_str(frame.filename), frame.lineno, frame.name))
            if frame.line:
                row.append(u('    {0}\n').format(frame.line.strip()))
            if frame.locals:
                for name, value in sorted(frame.locals.items()):
                    row.append(u('    {name} = {value}\n').format(name=name, value=value))
            result.append(u('').join(row))
        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号