假如有个python 代码文件 first.py, 执行的话为: python first.py 或者python3 first.py
执行完后继续回到cmd 状态,没法查看运行后的变量,等等.
如果要交互式,需要python 或者python3
但需要调用first.py。
方案1:
python -i first.py
方案2:
python 或python3 进入交互式
对于python2:
>>> execfile('first.py')
对于python3:
>>> exec(open("./first.py").read())
:我喜欢方案1.
参考链接: