如何从IDLE交互式shell运行python脚本?

如何在IDLE交互式shell中运行python脚本?

以下引发错误

>>> python helloworld.py
SyntaxError: invalid Syntax
内置功能execfile
execfile('helloworld.py')

自2.6:popen后弃用

import os
os.popen('python helloworld.py') # Just run the program
os.popen('python helloworld.py').read() # Also gets you the stdout

预先使用:subprocess

import subprocess
subprocess.call(['python','helloworld.py']) # Just run the program
subprocess.check_output(['python','helloworld.py']) # Also gets you the stdout

阅读文档的详细信息:-)

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...