【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

相关推荐
CTA终结者10 分钟前
2026年程序员量化开发学习:用示例、拆解和练习入门
人工智能·python
小酒星小杜12 分钟前
如何简单地创建你的第一部漫画?从一个“可见变化”开始
人工智能·python·产品
sel_920 分钟前
【OPD论文导读(二)】OPD(On-Policy Distillation)全景调研:十篇论文讲透“在自己生成的内容上学习“这件事
人工智能·python·深度学习·学习·算法·语言模型
北山小恐龙22 分钟前
使用手势在电脑刷抖音
人工智能·python·深度学习·yolo·机器学习·计算机视觉
GlueNa2SiO341 分钟前
01-Flask入门与环境搭建
笔记·python·学习·flask
李可以量化1 小时前
redis-py 从了解到精通(三):Redis Key 核心操作函数详解(上)
python
卷无止境1 小时前
FastAPI 实现 SSO,从协议原理到生产级落地
后端·python·fastapi
卷无止境1 小时前
FastAPI 与 RustFS 集成指南
后端·python·fastapi
青 春 记 忆1 小时前
零基础入门python25:新增账目——Decimal、日期和输入校验
python·后端开发
北风toto1 小时前
阿里云 MaxCompute通过python脚本调用odps流程和执行sql
python·阿里云·odps