我试图编写一个python脚本,以打开一个新的Terminal窗口并运行以下“ echo“ hello world”“。
到目前为止,我遇到了一个错误。
我的代码:
import os
os.system('osascript -e "tell application "Terminal" to do script "echo hello""')
subprocess.call("osascript -e 'tell application \'Terminal\' to do script \'echo hello\''", shell=True)
这两个命令都出错:
29:38: syntax error: A “script” can’t go after this identifier. (-2740)
29:38: syntax error: A “script” can’t go after this identifier. (-2740)