【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

相关推荐
lifloveyou7 小时前
table接口结构
python
Warson_L9 小时前
class 扩展
python
前端与小赵10 小时前
Python 数据结构陷阱与复数运算优化:列表、元组、字典成员操作辨析及 NumPy 高效实践
python
天天进步201510 小时前
Python全栈项目--基于深度学习的视频目标跟踪系统
python·深度学习·音视频
天天进步201510 小时前
Python全栈项目--Python自动化运维工具开发
运维·python·自动化
(●—●)橘子……11 小时前
力扣第503场周赛练习理解
python·学习·算法·leetcode·职场和发展·周赛
爱吃羊的老虎11 小时前
【JAVA】python转java:Spring Boot 入门
java·spring boot·python
小桥流水---人工智能12 小时前
【已解决】ImportError: cannot import name ‘AdamW‘ from ‘transformers.optimization‘
python
芝麻开门GEO12 小时前
泰安GEO优化服务,真的能提升效果吗?
人工智能·python
颜酱12 小时前
选读:工业级调用 LangChain:从 Demo 到企业级应用
python