[英]How to run a python script in IDLE using CMD prompt
I am wondering if there is a way to open a python script in IDLE run mode, (the equivalent of opening it with idle.exe {path} and pressing F5) or set it up so that if a.py file is open with IDLE it automatically runs it.我想知道是否有办法在 IDLE 运行模式下打开 python 脚本(相当于用 idle.exe {path} 打开它并按 F5)或设置它以便如果 a.py 文件以 IDLE 打开它会自动运行它。
#Opens without IDLE GUI
python {path}
#Opens in IDLE, but in editor mode
@ECHO OFF
idle.exe {path_to_idle}
# Running script.py in idle
idle.exe -r script.py
You might consider using:您可以考虑使用:
# Inspect interactively after running script (see "python --help" from cmd)
python -i script.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.