Debugging a Python script using the PDB

Source: Internet
Author: User

The PDB is a Python-brought package that provides an interactive source code debugging feature for Python programs, including setting breakpoints, stepping through debugging, entering function debugging, viewing current code, viewing stack fragments, dynamically changing the values of variables, and more. The PDB provides some common debugging commands

thead> td> continue executing program
command explanation
break or B set breakpoint set breakpoint
continue or C
list or L View Code snippet for current line
step or S enter function
return or R executes the code until it returns from the current function
exit or Q abort and exit
next or n execute next line
pp Print variable value
help help

The following is a typical Python debugging process:

1 Import PDB 2 pdb.set_trace () 3  " AAA " 4  " BBB " 5  " CCC " 6  Final = a + B +7  Print final

Debugging Python scripts with PDB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.