preprocess.py 文件源码

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

项目:vizgen 作者: uva-graphics 项目源码 文件源码
def add_str_node(root):
    nodeList = [i for i in ast.walk(root) if (isinstance(i, ast.stmt))]
    for i in nodeList:
        if(hasattr(i,'value') and hasattr(i.value,'s') and hasattr(i.value,'s')):
            continue
        if(hasattr(i,'lineno')):
            s = ast.Str('Line ' + str(i.lineno) + '')
            new_node = ast.Expr()
            new_node.value = s
            py_ast.add_after_node(root, i, new_node)
    return root
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号