我想在库模块中打印变量的值,例如sklearn.metrics中的roc_auc_score函数。我导入了pdb模块:
>>> import numpy as np
>>> from sklearn.metrics import roc_auc_score
>>> y_true = np.array([0, 0, 1, 1])
>>> y_scores = np.array([0.1, 0.4, 0.35, 0.8])
>>> import pdb
>>> pdb.set_trace()
(Pdb) b roc_auc_score
Breakpoint 1 at /usr/local/lib/python3.5/dist-packages/sklearn/metrics/ranking.py:244
(Pdb) roc_auc_score(y_true, y_scores)
我希望该函数将中断并在模块“ ranking.py”的第224行等待,但函数完成时没有中断。如何使执行停止在模块“ ranking.py”内部?