选择的十个项目包含了Debug
工具、删除Facebook
文章、无限云盘存储空间、AI
水军、并发运算工具、量化交易系统等等。
那么就来看看这十个项目吧!
第一名:PySnooper
这是一款调试代码的工具,让你不需要再通过采用print
来定位错误发生的地方和原因。目前有11000+
星。
PySnooper
可以让你不需要仔细选择哪些行需要打印信息,只需要对目标函数添加一行装饰器,就可以知道很仔细看到函数的运行状况,包括哪行运行、局部变量的变化等。
安装方法很简单,可以使用pip
或 anaconda
两种安装方法:
$ pip install pysnooper
或者
$ conda install -c conda-forge pysnooper
一个使用例子如下,首先是需要导入pysnooper
,然后想知道函数 number_to_bits()
的运行情况,只需要添加 @pysnooper.snoop()
即可。
import pysnooper
@pysnooper.snoop()
def number_to_bits(number):
if number:
bits = []
while number:
number, remainder = divmod(number, 2)
bits.insert(0, remainder)
return bits
else:
return [0]
number_to_bits(6)
得到的输出结果:
Starting var:.. number = 6
15:29:11.327032 call 4 def number_to_bits(number):
15:29:11.327032 line 5 if number:
15:29: