【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

相关推荐
程序员杰哥8 小时前
2026软件测试面试宝典(含答案+文档)
自动化测试·软件测试·python·测试工具·面试·职场和发展·测试用例
寻星探路8 小时前
【算法进阶】滑动窗口与前缀和:从“和为 K”到“最小覆盖子串”的极限挑战
java·开发语言·c++·人工智能·python·算法·ai
木木木一8 小时前
Rust学习记录--C10 泛型,Trait,生命周期
python·学习·rust
WangYaolove13148 小时前
基于深度学习的身份证识别考勤系统(源码+文档)
python·mysql·django·毕业设计·源码
weixin_445054728 小时前
力扣热题53
开发语言·python
数据大魔方9 小时前
【期货量化实战】豆粕期货量化交易策略(Python完整代码)
开发语言·数据库·python·算法·github·程序员创富
@汤圆酱9 小时前
【无标题】
python·jmeter
内存不泄露9 小时前
基于 Spring Boot 的医院预约挂号系统(全端协同)设计与实现
java·vue.js·spring boot·python·flask
码农幻想梦9 小时前
实验7 知识表示与推理
开发语言·人工智能·python
写代码的【黑咖啡】9 小时前
深入理解 Python 中的 SQLAlchemy
开发语言·python·oracle