我目前了解两种工具:
base64编码器/解码器:
python -m base64 -e <input
python -m base64 -d <input
json验证器和漂亮的打印机
python -m json.tool <input
其中输入可以是标准输入或文件。
我很好奇SPL是否有其他工具以类似的方式工作?
答案 0 :(得分:107)
不完整清单......
Base64 en / decoding:
python -m base64 -d [file]
python -m base64 -e [file]
ROT-13 en / decoder:
python -m encodings.rot_13
Macintosh BinHex:
# binhex <file> to <file>.hqx, and unbinhex <file>.hqx to <file>.viahqx
python -m binhex <file>
UUENCODE /解码:
python -m uu [infile [outfile]] # encode
python -m uu -d [infile [outfile]] # decode
MIME quoted-printable en / decoding:
python -m mimify -e [infile [outfile]] # encode
python -m mimify -d [infile [outfile]] # decode
Quoted-printable en / decoding:
python -m quopri [file] # encode
python -m quopri -d [file] # decode
的GZip:
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 Validator和漂亮的打印机:
python -m json.tool [infile [outfile]]
列出POP3邮箱:
python -m poplib <server> <username> <password>
SMTP服务器:
python -m smtpd
发送邮件(发送到localhost):
python -m smtplib
Telnet客户端:
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
打开webbrowser:
python -m webbrowser -n <url> # new window
python -m webbrowser -t <url> # new tab
python -m antigravity
Pure-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 executor:
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
答案 1 :(得分:30)
许多。
$ grep "if __name__ == '__main__':" /usr/lib64/python2.7/* | wc -l
55
但并非所有工作都是过滤器,所以在运行之前检查有问题的模块。
答案 2 :(得分:12)
此外,还有:
python -m this
答案 3 :(得分:1)
Cheeseshop上还有-m兼容软件包。试试“e”或“oo”: - )