Python pdb debugging

Source: Internet
Author: User

python-m pdb myscript.py #注意这会重启myscript. py

You can set breakpoints like this in your program:
Import PDB; Pdb.set_trace ()

You can modify the value of a variable, but be aware that it is preceded by! For example, to modify the final value, this should!final= "NewValue"

Supported commands:
P Print Variables
N Next
Step Fine Point operation
C Continue
L List
A args prints the parameters of the current function
Condition Bpnumber [Condition]
Clear/disable/enable Clear/disable/enable breakpoints
Q quit

Add:

1.import SYS

2. In the place where you need to set breakpoints, write down: Pdb.set_trace ()

3. Under CMD, enter execute command such as Python test.py   ' * * * *   (* * * for system parameters, incoming to executable file)

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.