僅使用打印語句進行調試

| |

我最近用 Python 編寫了很多代碼。而且我一直在處理我以前從未使用過的數據,使用以前從未見過的公式並處理巨大的文件。這一切讓我寫了很多打印語句來驗證它是否一切正常並確定要點的失敗。但是,一般來說,輸出這麼多信息並不是一個好習慣。如何僅在我想調試時使用打印語句,而在我不想打印時讓它們被跳過?

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method