How to debug python programs in Jupyter notebook
This article mainly analyzes the relevant knowledge points of how to debug python programs in Jupyter notebook, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about how to debug python programs in Jupyter notebook.
What does python mean Python is a cross-platform, interpretive, compiled, interactive and object-oriented scripting language, originally designed to write automated scripts, and is often used to develop independent and large-scale projects as versions are constantly updated and new features are added.
Jupyter notebook is simple and easy to use and has become a darling in the field of data analysis and machine learning. If bug appears in the process of running the program, it will inevitably need to be debugged. There is a difference between debugging in IDE (integrated development environment) and debugging in Jupyter notebook. Today we will learn how to debug a program in Jupyter notebook.
The debugging of jupyter is realized through the pdb library that comes with python. It is divided into the following steps (click to enlarge the picture):
1) import pdb is required first.
2) then write the statement pdb.set_trace () after import
3) the following shows several functions with a simple code as an example:
Open the home page of jupyter to create a new file and enter the following statement
Import pdbpdb.set_trace () def sum (aformab): c=a+b return ca=1b=2c=sum (ameme b) print (c) Click and drag to move
This is the end of the introduction on "how to debug python programs in Jupyter notebook". More related content can be searched for previous articles, hoping to help you answer questions, please support the website!