【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

相关推荐
SEO_juper7 分钟前
Node.js 全站死链检测工具:从 sitemap 出发一次找全 404
开发语言·人工智能·python·node.js·seo·外贸独立站
ljt272496066111 分钟前
Python笔记(九)--asyncio
笔记·python
老孟说禅20 分钟前
自动化测试实战(二)
python
2601_9679873725 分钟前
你们都用Python实现了哪些自动化办公?
python·excel·自动化办公·1024程序员节·学习资料·跨平台操作
wflynn26 分钟前
GitHub 今日推荐|Snapintosh:用 ARM EL2 监控器骗过内核,让骁龙芯片笔记本跑 macOS
python·开源·github
happylifetree38 分钟前
Python69:核心语法-函数进阶-案例1(递归)
python
外收内放39 分钟前
FastAPI猜字谜实战(3):把每一局存成JSON
开发语言·python·学习·json·fastapi
小白学大数据40 分钟前
基于 Python 的家具消费数据分析全链路实战:从数据治理到销售预测
人工智能·python·数据分析
镜子AI42 分钟前
镜子AI案例工程复盘:用Python给GEO效果做抽样检测与置信区间估计
开发语言·人工智能·python
WenGyyyL1 小时前
从零理解强化学习:为什么 AI 需要 Advantage,而不只是 Reward?
人工智能·python·深度学习·机器学习·nlp