[python]debugger包PySnooper

2019-04-23  本文已影响0人  VanJordan
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)
python3 test.py 2>&1 | tee log.log
@pysnooper.snoop(prefix='ZZZ ')
@pysnooper.snoop(variables=('foo.bar', 'self.whatever'))
@pysnooper.snoop(depth=2)
上一篇下一篇

猜你喜欢

热点阅读