在特定的脚本行上启动交互模式 [英] start interactive mode on a specific script line

查看:58
本文介绍了在特定的脚本行上启动交互模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要照常运行Python脚本,但是我想停止在特定行上执行并开始交互模式.

I need to run my Python script as usual, but I want to stop execution on a specific line and start interactive mode.

换句话说,我希望能够在那时检查所有变量的值,然后从python的命令行继续进行操作.

In other words, I want to be able to check the value of all my variables at that point, and continue myself from there on python's command line.

我该怎么做?

推荐答案

这可以通过code模块完成.最简单的方法是调用 code.interact() .

This can be done with the code module. The easiest way is to call code.interact().

这篇关于在特定的脚本行上启动交互模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆