python debugging
import pdb
for i in range(0,10):
x=i*3
print(i,x)
pdb.set_trace()
Note:
n means next
c means continue
x print current x value
i print current i value
output:
0 0
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
0
(Pdb) x
0
(Pdb) c
1 3
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
1
(Pdb) x
3
(Pdb) c
2 6
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
2
(Pdb) x
6
(Pdb) n
> d:\siva krishna\python_practice\python tricks\debuggin.py(4)<module>()
-> x=i*3
(Pdb) c
3 9
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
3
(Pdb) x
9
(Pdb)
import pdb
for i in range(0,10):
x=i*3
print(i,x)
pdb.set_trace()
Note:
n means next
c means continue
x print current x value
i print current i value
output:
0 0
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
0
(Pdb) x
0
(Pdb) c
1 3
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
1
(Pdb) x
3
(Pdb) c
2 6
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
2
(Pdb) x
6
(Pdb) n
> d:\siva krishna\python_practice\python tricks\debuggin.py(4)<module>()
-> x=i*3
(Pdb) c
3 9
> d:\siva krishna\python_practice\python tricks\debuggin.py(3)<module>()
-> for i in range(0,10):
(Pdb) i
3
(Pdb) x
9
(Pdb)
No comments:
Post a Comment