【Python】运行tcl、perl程序

只要你的环境可以执行tcl、perl脚本,也就是说安装了perl、tcl的解释器。那么python程序就可以执行tcl、perl。

示例:

python 复制代码
import subprocess

tcl_script_path = "D:\\Perl_WorkSpace\\test.tcl"
tcl_run_result = subprocess.run(['tclsh', tcl_script_path], capture_output=True, text=True)

print("tcl script output:\n", tcl_run_result.stdout)

if tcl_run_result.stderr:
    print("ERROR:", tcl_run_result.stderr)

perl_script_path = "D:\\Perl_WorkSpace\\TXT_COMPARE.pl"
perl_run_result = subprocess.run(['perl', perl_script_path], capture_output=True, text=True)

print("perl script output:\n", perl_run_result.stdout)

if perl_run_result.stderr:
    print("ERROR:", perl_run_result.stderr)

主要使用到了 subprocess模块。关于这个参考如下链接:

https://www.runoob.com/w3cnote/python3-subprocess.html

https://blog.51cto.com/u_16213402/11617608

相关推荐
Zzzz_my37 分钟前
正则表达式(RE)
pytorch·python·正则表达式
天天鸭1 小时前
前端仔写了个 AI Agent,才发现大模型只干了 10% 的活
前端·python·ai编程
setmoon2141 小时前
使用Scikit-learn构建你的第一个机器学习模型
jvm·数据库·python
2401_833197732 小时前
为你的Python脚本添加图形界面(GUI)
jvm·数据库·python
敏编程3 小时前
一天一个Python库:tomlkit - 轻松解析和操作TOML配置
python
2401_879693873 小时前
使用Python进行图像识别:CNN卷积神经网络实战
jvm·数据库·python
yunyun321233 小时前
机器学习模型部署:将模型转化为Web API
jvm·数据库·python
团子和二花3 小时前
openclaw平替之nanobot源码解析(七):Gateway与多渠道集成
python·gateway·agent·智能体·openclaw·nanobot
未知鱼4 小时前
Python安全开发之简易目录扫描器(含详细注释)
开发语言·python·安全
Be1k04 小时前
推荐一款语雀知识库批量导出工具
python·gui·工具·语雀·批量导出·原创