一个漂亮的python打印机。

pprintast的Python项目详细描述


pprintast

PyPi releasePyPi versionsDownloadsDocumentation Status

一个ast(抽象语法树)漂亮的python打印机。

Check out the pprintast docs

安装

$ pip install pprintast

用法

usage: pprintast.py [-h] [-a] [-c cmd] [-m mode] [-t] [-v] [file]

A pretty-printing dump function for the ast module. The code was copied from the ast.dump function
and modified slightly to pretty-print.

positional arguments:
  file                   program passed in as file

optional arguments:
  -h, --help             show this help message and exit
  -a, --attributes       include attributes such as line numbers and column offsets
  -c cmd, --command cmd  program passed in as string
  -m mode, --mode mode   compilation mode (choices: exec, eval, single) (default: exec)
  -t, --terse            terse output by disabling field annotations
  -v, --version          show program's version number and exit

脚本

使用pprintastcli从文件打印ast。

$ pprintast "./path/to/script.py"

使用pprintastcli从string打印ast。

$ pprintast -c "lambda a: a**2"

模块

使用pprintast模块从string打印ast。

# 1. import the "pprintast" function.frompprintastimportpprintastasppast# OR: from pprintast import ppast# 2. pretty print AST from a "string".exp="lambda a: a**2"ppast(exp)

stdout

许可证

麻省理工学院Travis Clarke

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用Java将JSON转换为哈希映射   java如何通过使用MapStruct从源对象复制值来填充目标对象内部的映射?   注入泛型类型为@InjectGuice的类时发生java错误   字符串如何在JavaIDE中导入基本符号   在Java中将JSON转换为List<List<String>>   java Java9 HttpClient SSLHandshakeException   java jOOQ代码生成器   java如何调整图标(图像按钮),使其不会放大?   java我可以在使用Eclipse时安装2个或更多Android SDK吗   sqlite Java实现DAO   如何解决此错误?“java.lang.NoSuchFieldError:org.apache.http.conn.ssl.SSLConnectionSocketFactory上的实例。<clinit>。”   java Maven:将基于OSP的zip文件解压缩到WEBINF/lib   java如何在每次调用函数时获取当前gps位置?