gpt4 book ai didi

python - pdb有没有初始化文件(类似于.gdbinit)?

转载 作者:太空宇宙 更新时间:2023-11-03 15:04:49 24 4
gpt4 key购买 nike

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

最佳答案

是的,根据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 解释器中键入的一样,所以它可以让您完成您想要的。

关于python - pdb有没有初始化文件(类似于.gdbinit)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34138105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com