是否有pdb的初始化文件(类似于.gdbinit)?

2024-05-04 16:05:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python的新手,并且习惯于使用gdb。我想知道是否有一种方法可以使pdb的初始化文件类似于.gdbinit。主要原因是我想定义函数,这样我就不必每次启动pdb时都键入import os; os.system('clear')(例如python -m pdb somescript.py


Tags: 文件方法函数import键入定义os原因
2条回答

是的,根据documentation

If a file .pdbrc exists in the user’s home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file.

请注意,键入命令就像在pdb解释器中键入命令一样,这样就可以完成所需的操作。你知道吗

是的,.pdbrc。你知道吗

可以使用Ned's .pdbrc file作为起点。它非常有用。你知道吗

相关问题 更多 >