Debugging Python with Ipdb

Source: Internet
Author: User

1. Installation

Pip Install ipdb

1. function

Python-m ipdb xxx.py

Inside the program:

From ipdb Import

Set_trace Set_trace ()

3. Common commands

  • ENTER(Repeat Last command)
  • cContinue to
  • l(Find where it is currently located)
  • s(Go to subroutine)
  • r(run until subroutine ends)
  • !<python 命令>
  • hHelp
  • A (RGS) prints the parameters of the current function
  • J (UMP) lets the program jump to the specified number of rows
  • L (IST) can list code blocks that are currently going to run
  • N (EXT) lets the program run the next line, if the current statement has a function call, n is not entered in the called function body
  • P (rint) One of the most useful commands to print a variable
  • Q (uit) exit debug
  • R (Eturn) continues execution until the function body returns
  • S (TEP) is similar to n, but if there is currently a function call, then s will enter the body of the called function

Debugging Python with Ipdb

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.