【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

相关推荐
96773 分钟前
python基础自学
开发语言·windows·python
毕设源码-朱学姐4 分钟前
【开题答辩全过程】以 基于Python的茶语店饮品管理系统的设计与实现为例,包含答辩的问题和答案
开发语言·python
我想回家种地4 分钟前
python期末复习重点
前端·javascript·python
rgeshfgreh7 分钟前
掌握PyWinAuto:高效Windows自动化
python
xwill*8 分钟前
wandb的使用方法,以navrl为例
开发语言·python·深度学习
rgeshfgreh14 分钟前
解决Windows系统Python命令无效问题
python
jinglong.zha19 分钟前
AScript游戏进阶课程 - 实战课表(0基础小白从入门到精通系列课程)
python·自动化·懒人精灵·ascript·游戏脚本
bybitq21 分钟前
Leetcode131题解 -Python-回溯+cache缓存
开发语言·python
SunnyDays101124 分钟前
如何使用 Python 合并多个 Excel 文件
python·合并excel文件·合并excel表格
lixzest24 分钟前
PyTorch张量(Tensor)简介
python