Tips for debugging Python program?

0 votes
What are your best tips for debugging Python program?
Oct 29, 2018 in Python by findingbugs
• 3,170 points
29 views

1 answer to this question.

0 votes

Follow the documentation pn PDB here :- 

PDB

You can use the pdb module, insert pdb.set_trace() anywhere and it will function as a breakpoint.

>>> import pdb
>>> a="a string"
>>> pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) p a
'a string'
(Pdb)

To continue execution use c (or cont or continue).

It is possible to execute arbitrary Python expressions using pdb. 

For example, if you find a mistake, you can correct the code, then type a type expression to have the same effect in the running code.

answered Oct 29, 2018 by Priyaj
• 56,900 points

Related Questions In Python

0 votes
1 answer

Python debugging tips

You can use the pdb module, insert ...READ MORE

answered Oct 26, 2018 in Python by SDeb
• 13,180 points
23 views
0 votes
1 answer

Unique identification for data items in Python

Try the UUID module of Python. For example, ...READ MORE

answered Apr 17, 2018 in Python by Nietzsche's daemon
• 4,260 points
43 views
0 votes
3 answers

Python Selenium best tutorials for beginners

Hope this will help you...Python Tutorial READ MORE

answered Feb 11 in Python by aldrinjohn
• 140 points
1,273 views
0 votes
1 answer

Slice notation in Python for string reversal

The slice notation is [start:end:step]. Step = ...READ MORE

answered Apr 25, 2018 in Python by Nietzsche's daemon
• 4,260 points
96 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 331 views
+4 votes
6 answers
0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

answered Jul 16, 2018 in Python by Priyaj
• 56,900 points
55 views
0 votes
1 answer

What is the Python equivalent for a case/switch statement?

if x == 'a':  # Do the ...READ MORE

answered Jul 26, 2018 in Python by Priyaj
• 56,900 points
98 views