我目前知道两个工具:
base64 编码器/解码器:
python -m base64 -e <input
python -m base64 -d <input
json 验证器和漂亮的打印机
python -m json.tool <input
其中输入可以是标准输入或文件。
我很好奇 SPL 是否还有其他以类似方式工作的工具?
我目前知道两个工具:
base64 编码器/解码器:
python -m base64 -e <input
python -m base64 -d <input
json 验证器和漂亮的打印机
python -m json.tool <input
其中输入可以是标准输入或文件。
我很好奇 SPL 是否还有其他以类似方式工作的工具?
不是一个完整的列表...
Base64 编码/解码:
python -m base64 -d [file]
python -m base64 -e [file]
ROT-13 编码/解码器:
python -m encodings.rot_13
Macintosh BinHex:
# binhex <file> to <file>.hqx, and unbinhex <file>.hqx to <file>.viahqx
python -m binhex <file>
UU编码/解码:
python -m uu [infile [outfile]] # encode
python -m uu -d [infile [outfile]] # decode
MIME 引用可打印编码/解码:
python -m mimify -e [infile [outfile]] # encode
python -m mimify -d [infile [outfile]] # decode
引用可打印的编码/解码:
python -m quopri [file] # encode
python -m quopri -d [file] # decode
压缩包:
python -m gzip [file] # compress
python -m gzip -d [file] # decompress
Zipfile提取等:
python -m zipfile -l <file> # list
python -m zipfile -t <file> # test
python -m zipfile -e <file> <dir> # extract
python -m zipfile -c <file> sources... # create
HTTP 服务器:
python -m BaseHTTPServer
python -m CGIHTTPServer
python -m SimpleHTTPServer
简单的FTP客户端:
python -m ftplib host [-l<dir-to-list>] [-d<dir-to-cwd>] [-p] [file-to-retrieve]
HTML文本提取:
python -m htmllib <file>
JSON 验证器和漂亮的打印机:
python -m json.tool [infile [outfile]]
列出 POP3 邮箱:
python -m poplib <server> <username> <password>
SMTP 服务器:
python -m smtpd
发送邮件消息(到本地主机):
python -m smtplib
远程登录客户端:
python -m telnetlib [host [port]]
MIME 类型/扩展名数据库:
python -m mimetypes file.ext # print type for filename
python -m mimetypes -e mime/type # print extension for type
打开网络浏览器:
python -m webbrowser -n <url> # new window
python -m webbrowser -t <url> # new tab
反重力:
python -m antigravity
纯 Python REPL:
python -m code
Python字节码批处理编译器:
python -m compileall
Python 代码分析器:
python -m cProfile <script>
python -m profile <script>
python -m pstats <filename> # print profiling statistics
Python doctest 执行器:
python -m doctest <script>
Python 基准测试:
python -m test.pystone [iterations]
python -m hotshot.stones
Python 交互式调试器:
python -m pdb
从模块中提取 Python 类和方法:
python -m pyclbr <script>
Python 文档浏览器:
python -m pydoc <topic>
python -m pydoc -g # graphical browser
python -m pydoc -p <port> # start HTTP docs server on port
Python片段计时器:
python -m timeit
日历(类似cal
,但可以做 HTML 和各种花哨的格式化的东西):
python -m calendar
目录比较器:
python -m filecmp [-r] dir1 dir2 # -r for recursive directory compare
段落格式:
python -m formatter [file]
显示当前平台(类似uname
但更简单):
python -m platform
许多。
$ grep "if __name__ == '__main__':" /usr/lib64/python2.7/* | wc -l
55
并不是所有的都可以作为过滤器,所以在运行之前检查有问题的模块。
Also, there is:
python -m this
Cheeseshop 上还有与 -m 兼容的软件包。试试“e”或“oo”:-)