def visit_Expr(self, node):
"""
Expr(expr value)
"""
val = self.visit(node.value)
if isinstance(node.value, ast.Str):
"""
<Python> "" * comment
* sub comment ""
<Ruby> # * comment
# * sub comment
"""
comment = val[1:-1]
indent = self.indent_string()
for s in comment.split('\n'):
s = re.sub(r'^%s' % indent, '', s)
self.write("# %s" % s)
else:
self.write(val)
评论列表
文章目录