repl.py 文件源码

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

项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码
def cleanup_code(self, content):
        """Automatically removes code blocks from the code."""
        # remove ```py\n
if content.startswith('```') and content.endswith('```'):
        return '\n'.join(content.split('\n')[1:-1])

    # remove `foo`
    for p in self.settings["REPL_PREFIX"]:
        if content.startswith(p):
            if p == '`':
                return content.strip('` \n')
            content = content[len(p):]
            return content.strip(' \n')

```

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号