【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

相关推荐
weixin_440730503 分钟前
python+request实现接口-小结
开发语言·python
zlinear数据采集卡27 分钟前
数据采集卡从入门到精通(38):上位机开发实战——Python/QT/LabVIEW的技术选型与分层架构
python·单片机·嵌入式硬件·qt·fpga开发·开源·labview
for_ever_love__1 小时前
PySpark学习: 数据输出
开发语言·python·学习·spark
张人玉1 小时前
基于 Python 的桌面端智能识别与可视化系统——生活垃圾分类可视化大屏
python·分类·sqlite·echarts·生活
何以解忧,唯有..1 小时前
Python os模块详解:文件与目录操作指南
java·服务器·python
言乐61 小时前
Python实现自动拉人脚本示例
开发语言·windows·python·django·pygame
归去来 兮1 小时前
Python爬虫爬取数据案例
开发语言·爬虫·python
何以解忧,唯有..2 小时前
Python logging 模块:从入门到精通
python·microsoft·php
quantdash_cc2 小时前
历史数据断层与REST请求慢到崩溃?QuantDash高性能量化数据API终极解决方案
开发语言·python·缓存·php·量化·quantdash
熊野君2 小时前
Prompt / RAG / 规则 / Skills —— 定位、协作与实现路线
开发语言·python