- Hands-On Enterprise Automation with Python.
- Bassem Aly
- 183字
- 2021-06-18 19:22:25
Code debugging
Code debugging is a process that can help you to understand the cause of an error, by providing an input to the code and walking through each line of the code and seeing how it evaluates at the end. The Python language contains some debugging tools to get insights from the code, starting with a simple print function, assert command till a complete unit testing for the code. PyCharm provides an easy way to debug the code and see the evaluated values.
To debug code in PyCharm (say, a nested for loop with if clauses), you need to set a breakpoint on the line at which you want PyCharm to stop the program execution. When PyCharm hits this line, it will pause the program and dump the memory to see the contents of each variable:

Notice that the value of each variable is printed besides it, on the first iteration:

Also, you can right-click on the breakpoint and add a specific condition for any variable. If the variable is evaluated to a specific value, then a log message will be printed:

- 自制編譯器
- 架構不再難(全5冊)
- Java高手真經(高級編程卷):Java Web高級開發技術
- JavaFX Essentials
- Python自然語言處理(微課版)
- Java加密與解密的藝術
- 零基礎輕松學SQL Server 2016
- Swift 4 Protocol-Oriented Programming(Third Edition)
- GitHub入門與實踐
- Extending Unity with Editor Scripting
- Mastering Android Studio 3
- 從零開始:C語言快速入門教程
- Data Manipulation with R(Second Edition)
- Python應用開發技術
- 編程的原則:改善代碼質量的101個方法