定位Python程序的性能
1 | python -m cProfile xxx.py |
备注:建议使用cProfile就好了,cProfile会更高效,因为它是用C开发的。
使用pdb调试Python程序
1 | python -m pdb xxx.py |
详细内容参见《Python中DEBUG调试模块PDB使用》
使用Python快速启动HTTP服务器
1 | python -m SimpleHTTPServer |
使用Python快速搭建FTP服务器
1 | pip install pyftpdlib |
使用Python格式化输出json数据
1 | cat data.json | python -m json.tool |
查看Python解释器的目录
1 | whereis python |
查看Python的安装目录
1 | import sys |
快速启动一个Python进程
1 | echo 'while True: pass' | python & |