# -*- coding:utf-8 -*- def func(num): s = num * 10 return s if __name__ == '__main__': print 'debug starting...' print '*' * 10 print 'debug ending…' num = 100 s = func(num) print s在python文件中不引用pdb库,可以在执行python文件的时候,加上参数:
def func(num): s = num * 10 return s if __name__ == '__main__': print 'debug starting...' print '*' * 10 pdb.set_trace() print 'debug ending…' num = 100 s = func(num) print s执行程序:python pdb_demo.py
Linux下使用pdb简单调试python程序,布布扣,bubuko.com
原文地址:http://blog.csdn.net/yiliumu/article/details/32749905