The code you write doesn't work well, so you need to debug, fix bugs and exceptions, and there are several ways to do it:
1 Print information via printf (). But cannot be deleted at the time of publication;
2 through the Assert condition expression, ' prompt message '; Start the interpreter with the-o parameter to close the message:python3-o
3 Output information through logging logs, and you can set the level of logging:debug, info,warning, error
Import logging
Logging.basicconfig (Level=logging.info)
Logging,info ("hint message")
4 via GDB:python3-m gdb filename.py, start with parameter- m PDB
Parameter 1: View Code
parameter N: Single Step execution
Parameter p variable: View variable
parameter Q: Exit Debugging
Breakpoint Debugging: Add Pdb.set_trace () where you need to stop and debug the breakpoint, and then use p to view the variable and continue running.
5 IED-supported debugs:pycharm
Python Learning Debugging: